ID:               50615
 User updated by:  jzumbrun at gmail dot com
 Reported By:      jzumbrun at gmail dot com
 Status:           Bogus
 Bug Type:         Regexps related
 Operating System: OsX 10.6.1
 PHP Version:      5.3.1
 New Comment:

Thanks for the clarity and for the quick response. 
Unfortunately I spent quite a bit of time trying to make the
preg_match() work with / by hand not knowing that preg_match() had a
configurable regex separator character. I can only find this in the
preg_quote() documentation. I would be supper nice if the preg_match()
docs mentioned you can change the regex separator character.


Previous Comments:
------------------------------------------------------------------------

[2009-12-31 04:23:44] [email protected]

Oh, and it is documented.  Look at the description of the optional 2nd

delimiter argument.

------------------------------------------------------------------------

[2009-12-31 04:21:50] [email protected]

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);

------------------------------------------------------------------------

[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

Reply via email to