Loading ...
Sorry, an error occurred while loading the content.

Re: [Clip] Brooding about ^$GetDocMatchAll

Expand Messages
  • buralex@gmail.com
    Flo: Sheri may have a more definitive answer but behavior you observe makes sense to me. Once having matched Hickory Di the pointer is here (marked by X):
    Message 1 of 35 , Jan 8, 2007
    • 0 Attachment
      Flo:

      Sheri may have a more definitive answer but behavior you observe makes
      sense to me.
      Once having matched "Hickory Di" the pointer is here (marked by X):
      Hickory DiXckory Dock
      so it now finds 1 character of the 0 to 3 you ask for (the 'c' in
      Dickory) followed by "kory Do" in "Dickory Dock"

      In your second test it doesn't find anything because you are asking for
      exactly three characters and there is only one preceding the second 'kory'

      If it worked the way you seem to be expecting then matching .{1,26}
      against the letters of the alphabet would match at least 26 times
      (possibly 26!) - my combinatorial mathematics is very foggy and at least
      30 years old!
      ie:
      ab --- zyz
      bv...xyz
      etc.


      > According to the Help File, ^$GetDocMatchAll "finds all matching
      > strings based on the supplied regexp pattern".
      >
      > Look at the words: Hickory Dickory Dock
      >
      > When executing...
      >
      > ^!SetListDelimiter ^p
      > ^!SetArray %Text%=^$GetDocMatchAll(".{0,3}kory.{0,3}")$
      > ^!Toolbar New Document
      > ^!InsertText ^%Text%
      >
      > I would expect to get...
      >
      > Hickory Di
      > Dickory Do
      >
      > Actually, the result is
      >
      > Hickory Di
      > ckory Do
      >
      > In the second string, I'm missing the "Di". When executing...
      >
      > ^!SetArray %Text%=^$GetDocMatchAll(".{3}kory.{3}")$
      >
      > the second string has vanished at all. Did I missunderstand that
      > command? Thanks for any help.
      Regards ... Alec -- buralex-gmail
      --
    • jonas_ramus
      ... Sheri, thanks - I should have noticed that by myself! With another r n it s perfect now. ... That s it! Those who don t want to remove these spaces may
      Message 35 of 35 , Jan 17, 2007
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
        >
        > Hi Flo,
        >
        > There should only be one difference between the two replace commands
        > (inclusion or exclusion of the \b's) but the second one is missing
        > the critical \r\n

        Sheri, thanks - I should have noticed that by myself! With another
        \r\n it's perfect now.

        > You also might want to close up the spaces in the replacement
        > clause, they will create extra spaces in the output.

        That's it! Those who don't want to remove these spaces may define a
        left context with ^!Set %Char_left%, and a right context with ^!Set %
        Char_right%=^$Calc(^%Char_left%-2)$ in order to get the same size of
        context on both sides.

        Thanks again for all the help from Alec and you in developing this
        clip!

        Flo

        PS Get well soon with your cold!
      Your message has been successfully submitted and would be delivered to recipients shortly.