When trying to make a regular expression that escapes SQL wildcards a
stumbled across this:
<?php
# Excpected result; "\%a\_"
# Prints "\1a\1"
echo preg_replace('/(%|_)/', '\\\1', '%a_');
?>
However, this snippet yields the correct result
<?php
echo preg_replace('/(%|_)/', '\\\\\1', '%a_');
?>
Am I missing something about regexps or is this a bug?
regards,
Marten.
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]