Hi,
How is everyone? I unsubscribed from the list for quite some time but
now find myself having a real dickens of a time with RegEx and was
hoping someone on this list could lend a hand.
I'm looking for a regex pattern that will find quoted strings (double
quotes) but skip (double-)quoted strings containing any of the
following characters: $'"\ (dollar sign, single quote, double quote,
backslash)
At first I tried "[^\$'"\\]+?" but it was matching the end of one
quoted string and the beginning of the next...
Here are some strings that should fail to match:
// contains escaped quotes and single quotes, the tricky part is the
last quoted string, which should fail...
$str = "`zcol ACOL` NUMBER(32,2) DEFAULT 'The \"cow\" (and Jim''s
dog) jumps over the moon' PRIMARY, INTI INT AUTO DEFAULT 0, zcol2
\"afs ds";
// contains dollar signs, backslashes and single quotes
ADOConnection::outp( "
-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>",false);
// contain single quotes
if (strncmp($val,"'",1) != 0 && substr($val,strlen($val)-1,1) != "'") {
// strings that should match
$myvar = "this is my quoeted ".$and_another_var." and another string";
Also, quoted strings should not be preceded with a backslash.
I've read and reread the BBEdit docs (which are great) but I've been
unable to come up with a method that passes all of these tests.
I never had any idea this could be such a complicated problem. Does
anyone see what I'm missing?
PS: I've got a new version of the PHP clipping set ready for release,
but need to finish building the new server first...
Ted Stresen-Reuter
http://clevernet.biz
http://www.tecnotertulia.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]>