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

Re: [NTB] Regular Expression: find between two words

Expand Messages
  • flo.gehrke
    ... Eb, I take for granted that word1 and word2 are part of the string -- without it the RegEx makes no sense. Although a Lookaround doesn t consume any
    Message 1 of 15 , Feb 29, 2012
    • 0 Attachment
      --- In notetab@yahoogroups.com, "Eb" <ebbtidalflats@...> wrote:
      >
      > Flo,
      >
      > James reports, that the expression
      >
      > "(?<=word1 )[^\r\n]*(?= word2)"
      >
      > fails to find " some text here "
      > (containing a double space on the left.
      >
      > Tests on my PC confirm this bug.
      >
      > Are you saying, YOUR NoteTab succeeds in finding the pattern?

      Eb,

      I take for granted that 'word1' and 'word2' are part of the string -- without it the RegEx makes no sense. Although a Lookaround doesn't consume any character those substrings must be there, of course.

      So we have to test the RegEx against...

      'word1 some text here word2'

      (two spaces after 'word1', one space preceding 'word2').

      As we've said before, after removing the spaces from the Assertions all characters between 'word1' and 'word2', including all spaces, are matched with '(?<=word1)[^\r\n]*(?=word2)'. This is - if I did'nt misunderstand him - what James aimed at, isn't it?

      For me, this is valid for NT 6.2 Pro / Win XP.

      Regards,
      Flo
    Your message has been successfully submitted and would be delivered to recipients shortly.