ID: 50615
Updated by: [email protected]
Reported By: jzumbrun at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Regexps related
Operating System: OsX 10.6.1
PHP Version: 5.3.1
New Comment:
The manual doesn't specifically talk about / because the regex
separator character is completely configurable. If you use another
char, like ~ for example, then you don't have to escape the /
eg.
preg_match("~$urlClass~", $line);
Previous Comments:
------------------------------------------------------------------------
[2009-12-31 02:19:37] jzumbrun at gmail dot com
Description:
------------
// $line equals line below from file:
$route['infox/(.*)'] = "articles/$1";
Basically I have to manually put an \ in front of the / char after
infox. preg_quote() wont escape it and the documentation doesnt say i
need to escape / chars. preg_match() is forcing me to put one there.
Reproduce code:
---------------
---
>From manual page: function.preg-quote
---
$urlClass = '\$route\['infox'/\(\.\*\)'\]';
preg_match("/$urlClass/", $line);
Expected result:
----------------
no errors
Actual result:
--------------
Message: preg_match() [function.preg-match]: Unknown modifier '\'
if i use $urlClass = '\$route\['infox'\/\(\.\*\)'\]';
it works (notice the \ infront of the 3rd char after infox)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50615&edit=1