#26854 [Opn->Bgs]: Using ! as a delimiter for regexps will not allow neg. lookahead assertions
| From: | andrei@php.net | Date: | Fri, 09 Jan 2004 17:57:59 +0000 |
| Subject: | #26854 [Opn->Bgs]: Using ! as a delimiter for regexps will not allow neg. lookahead assertions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-53038@lists.php.net to get a copy of this message | ||
ID: 26854
Updated by: andrei@php.net
Reported By: chris_se at gmx dot net
-Status: Open
+Status: Bogus
Bug Type: PCRE related
Operating System: Linux
PHP Version: 4.3.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Use a different delimiter instead. The library does not remove
backslashes before delimiters and PCRE doesn't know what to do with
(?\\!).
Previous Comments:
------------------------------------------------------------------------
[2004-01-09 12:39:04] chris_se at gmx dot net
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 this bug report at http://bugs.php.net/?id=26854&edit=1