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

24353Re: [Clip] Advice to add 'Tabs' to data.

Expand Messages
  • flo.gehrke
    Feb 14, 2014
    • 0 Attachment
      --In ntb-clips@yahoogroups.com, <don@...> wrote:

      > Atomic groups are something still a little past my grasp, though I use
      > them when I experience slow downs. I don't always understand why or
      > when. \K ... I'm working on it. Lookaheads and so forth I have down
      >  pretty  well now.

      Well, Don, in short, an Atomic Group says: "Don't look back if you don't achieve a match!" (similar to Possessive Quantifiers and certain Verbs).

      On the other hand: Be careful! Backtracking is absolutely necessary where the RegEx Engine must test alternations or options.

      Example: Given a string of 10,000 lines like...

      10110101000101110111001110111000100010011

      The following clip uses an Atomic Group in order to test if there is any line that ends with '11'...

      ^!Find "^(?>[01]+)11$" WR

      The result will be "No match!" though there are 10,000 lines ending with '11'.

      Why this?

      Since the Engine doesn't look back, all characters are consumed already with '[01]+'. Now, at the end of each line, the Engine tests for '11'. Since there is no '11' left, the testing fails, and there is no match.

      Regards,
      Flo
    • Show all 18 messages in this topic