Thanks for the help on this. That is definitely better than anything I had come up with, but I found some more strings that were not matching quite like I expected...

Nothing will ever work perfectly since it is a parsing problem akin to bracket matching which cannot really be done with PCRE (without the recursion hack).

I'm thinking I need some way of saying the string should be preceded by <?php at some point and NOT by ?>, and can optionally end with ?> (because in PHP you can leave the closing ?> at the end of a file off if you are not switching back to HTML).


You can remove the ?> by adding another negative lookbehind assertion:

(?<!\\)(?<!\?\>)"[^\$'"\\\r\n]+?(?<!\\)"

You can add as many negative lookbehind assertions as you like.

However I believe the lookbehind assertions must be fixed width (or nearly so), so there is no way to say "preceded by <?php at some point".

In any event, it wouldn't help since the only string that fails with your new test is

", "

which is pretty much doomed, unless you want to exclude strings starting with (or containing) a comma.

I always thought the question mark following an enumeration marker was the non-greedy symbol, telling the pattern to find the first occurrence or something like that...

Actually, you are indeed quite right, my appologies, I hadn't come across that notation.

BTW, the BBEdit Grep Reference is probably the best reference there is on Grep.

Enjoy,
   Peter.

--
Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac
<http://www.stairways.com/>           <http://download.stairways.com/>

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to