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

Re: regexp in NoteTab: general multiplier

Expand Messages
  • hugo_paulissen
    ... in NoteTab. In other words, I want to match on from 3 to 6 occurences of x . In Perl, this would be x{3,6}. Is there a similarly concise way to do this
    Message 1 of 2 , Mar 31, 2003
    • 0 Attachment
      > New question: I can't get Perl style general multipliers to work
      in NoteTab. In other words, I want to match on "from 3 to 6
      occurences of x". In Perl, this would be x{3,6}. Is there a
      similarly concise way to do this in NoteTab? If not, what is the
      most concise way to do this supported by NoteTab?
      >
      > Thanks,
      >
      > Paul
      >

      Paul,

      What you could try to do is to see how many x'es are in the document
      first. If the number you get is out of bounds, stop processing -
      otherwise: find the first match, find the last match and select
      anything inbetween.

      Example included (searches for "the")...

      ^!Select ALL
      ^!Set %ALL%=^$GetSelection$
      ^!Jump DOC_START
      ^!Set %substr%="the"
      ^!Set %xtimes%=^$StrCount("^%substr%";"^%ALL%";0;0)$
      ^!If ^%xtimes%<3 END
      ^!If ^%xtimes%>8 END
      ^!Find ^%substr% S
      ^!Set %start%=^$GetRow$:^$GetColStart$
      ^!Jump DOC_END
      ^!Find ^%substr% SB
      ^!SetCursor ^$GetRow$:^$GetColEnd$
      ^!SelectTo ^%start%
      :END
      ^!INFO "^%substr%" appears ^%xtimes% times
    Your message has been successfully submitted and would be delivered to recipients shortly.