I don't like to answer my own question, but in case someone else is
looking... The following regex does what I need, more or less:

(?x)
ereg\(
# find the first parameter, which could be a string, a variable, or
embedded functions
(["'])?(?(1)(((?:\\?.)*?)(\1))|(\$)?(?(5)([a-z][a-z0-9_]*)|([a-z][a-
z0-9_]*\(.*\))?))
\s*,\s*
# find the second parameter, which could be a string, a variable, or
embedded functions
(["'])?(?(8)(((?:\\?.)*?)(\8))|(\$)?(?(12)([a-z][a-z0-9_]*)|([a-z][a-
z0-9_]*\(.*\))?))\s*
\)

will match the following strings:

ereg('sdfs', $variable);
ereg('"', $variable);
ereg('"\'', $variable);
ereg($variable, '"\'');
ereg(addslashes($variable), '"\'');
ereg('"\'', addslashes($variable));
ereg('sdfs', addslashes($variable));
ereg('"', addslashes($variable));
ereg('"\'', addslashes($variable));

I am now able to search and replace ereg() for preg_match() in PHP
thus preparing my scripts for PHP 6. Wheeee!

Note that the (?x) simply tells BBEdit to ignore white space in the
pattern, but that \s* is necessary.

PS: And it only took me about 4 hours to get this working! ;-) Why do
such things always end up being sooo time-consuming?!?!

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.

To unsubscribe from this group, send email to 
bbedit+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to