Re: [NTB] Regular Expression: find between two words
- I'm not sure that s/he was looking for a clip and I'm not sure that s/he
is even a member of clips. This Thread is a bit advanced for the
general group and has been going both places ... I apologize for not
knowing where to send it.
You suggest this:
I think in addition to \b there you need to provide for end of file or
return at the end of word2? Or are those included in \b? \b in help
simply says: "word boundary (only ASCII letters recognized)."
I learn a lot in these discussions so thanks to all participating.
- --- In firstname.lastname@example.org, "Eb" <ebbtidalflats@...> wrote:
> 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?
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.