Reply To: GREP Bug in Lookaround?

#84280
Matt Isaac
Participant

In my experiences, positive lookaheads do support wildcards; though they always search for the shortest match. If you used (?=a?c) “positive lookahead of zero or one a followed by a c” it will search instead for “positive lookahead of a c” since the shortest match of “a?c” is “c”.

That being said.. In dreerr’s original expression “(?<=~P)(.+?)~b(?=~b{2})” the “(.+?)~b(?=~b{2})” part of the expressions does what it should in selecting any text followed by a carriage return that comes before two carriage returns. The only thing throwing the expression off is the positive lookbehind of a page break. which goes back to Ari’s original reply as positive lookbehinds being unable to look to a previous text frame.

Though as a workaround you can apply the paragraph style to “(?<=~P)(.+?)~b(?=~b{2})” then go through and remove the paragraph style from “.+~P(?=.+~b{3})”. It’s a bit more work but it does work in the end.

This article was last modified on April 25, 2016

Comments (0)

Loading comments...