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

Re: Brooding about ^$GetDocMatchAll

Expand Messages
  • Sheri
    ... You could first determine if there are any overlaps by using a lookahead assertion, e.g., see if you get a a hit on this Find: ^!Find
    Message 1 of 35 , Jan 9, 2007
    • 0 Attachment
      --- In ntb-clips@yahoogroups.com, "jonas_ramus" <flo.gehrke@...>

      > I would expect to get...
      >
      > Hickory Di
      > Dickory Do
      >

      You could first determine if there are any overlaps by using a
      lookahead assertion, e.g., see if you get a a hit on this Find:

      ^!Find "[^\r\n]{0,3}kory[^\r\n]{0,3}(?=[^\r\n]{0,2}kory)" RS

      If so you could do something like this in lieu of the ^$GetDocMatchAll$:

      ^!Jump Doc_Start
      :loop
      ^!Find "[^\r\n]{0,3}kory" RS0
      ^!Iferror Out
      ^!Set %startcol%=^$GetColStart$
      ^!Set %nextstart%=^$GetColEnd$
      ^!SetCursor ^$GetRow$:^%startcol%
      ^!Find "[^\r\n]{0,3}kory[^\r\n]{0,3}" RS
      ^!Set %mylist%=^%mylist%^$GetSelection$^%NL%
      ^!Setcursor ^%GetRow$:^%nextstart%
      ^!MoveCursor +1
      ^!Goto loop
      :Out
      ^!Toolbar New Document
      ^!InsertText ^%mylist%
      ^!ClearVariable %mylist%
      ^!ClearVariable %startcol%
      ^!ClearVariable %endcol%
      ;end of clip
    • 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.