From: chris_se at gmx dot net
Operating system: Linux
PHP version: 4.3.4
PHP Bug Type: PCRE related
Bug description: Using ! as a delimiter for regexps will not allow neg. lookahead
assertions
Description:
------------
When I try to use ! as delimiter and use a negative lookahead assertion
which is normally started with (?!, (?! of course does not work, because
the ! will terminate the pattern (and PHP will of course complain). But
when I try to escape the exclamation mark like (?\!, an error occurs.
I assume the \ is not removed in front of the ! after the pattern is freed
from its delimiters.
Reproduce code:
---------------
$res = preg_match ("!^(?\\!foo)[a-z]{3}$!", "bar");
Expected result:
----------------
$res contains true
Actual result:
--------------
Warning: Compilation failed: unrecognized character after (? at offset 3
in /home/christian/- on line 2
--
Edit bug report at http://bugs.php.net/?id=26854&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26854&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26854&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26854&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26854&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26854&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26854&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26854&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26854&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26854&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26854&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26854&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26854&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26854&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26854&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26854&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26854&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26854&r=float