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

22605Re: [Clip] Re: FIND in NTL V7pr3 still acting odd

Expand Messages
  • Eric Fookes
    Apr 16, 2012
      Hi John,

      > I found an interesting thing while testing this: When finding with
      > just \s* on the pattern below, it stops at each character position
      > until it gets to a whitespace character, then finds that. Just keep
      > clicking Find until it finally finds a whitespace. I tried adding a
      > space after the letters, and found that it would find both the space
      > and the CR, but only after it had stopped at each character position
      > first. This seems wrong, such as \s? might produce. So \s* does not
      > find a space or a CR until it has stepped through character positions
      > to the point of the whitespace.

      This works as designed. When a successful match has a length of zero
      characters, NoteTab then shifts position by one character on repeating
      the search. This is necessary to avoid getting stuck in an infinite loop
      when running a Replace All operation.

      Using \s+ avoids this issue because a successful match must be at least
      one character.

      > In the past, I have noticed some erratic behavior with \s* in my clip
      > library, and couldn't understand what was causing it. I changed my
      > clips to not use \s in some of those cases, and now don't use it
      > much. At least this little exercise demonstrates that there is some
      > unexpected behavior, even if it is as intended.

      I think in most cases it is best to avoid running RE searches that can
      produce 0-character matches.


      Eric Fookes
    • Show all 15 messages in this topic