Thanks again for all the clarification and help. In the end I ended
up going with the following since, as I kept exploring, I kept
finding exceptions and soon realized that it would be easier to
specify what I will allow in quotes than what is not allowed (always
learning something new):
(?s)(?<!name=|action=|align=|valign=|width=|height=|nowrap=|scope=|
class=|id=|style=|type=|value=|method=|border=|cellspacing=|
cellpadding=|colspan=|size=|maxlength=|for=|label=|rows=|cols=|wrap=|
language=|href=|version=|fuse=|charset=|src=|alt=|title=|xmlns=|http-
equiv=|rel=|content=|rowspan=|checked=|accept=|face=)(?<!\')(?<!\\)(?
<!\?\>)"((?!\.|,|, | ,| , |\. | \. |:| :|: | : )[[:alnum:] \-\_\.\,\:\
[EMAIL PROTECTED]<\>\?\(\)\*/]*?(?<!\\))"
Not pretty, but it did the job!
Thanks again!
Ted
On Sep 19, 2007, at 1:30 PM, Peter N Lewis wrote:
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]>
--
------------------------------------------------------------------
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]>