ID: 36442 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Irrelevant PHP Version: Irrelevant New Comment:
ok, regex improved. Previous Comments: ------------------------------------------------------------------------ [2006-02-18 16:45:48] [EMAIL PROTECTED] Rectification: it will work using X PCRE_EXTRA modifier, my bad. ------------------------------------------------------------------------ [2006-02-18 16:41:35] [EMAIL PROTECTED] In the examples of other pcre functions, "|" was often used as an alternative. (e.g. http://php.net/preg_match_all http://php.net/preg_replace_callback) The fact that chars used as delimiter must be escaped in the regex is already stated here: http://php.net/pcre#pcre.intro The point is : having to escape a delimiter in the regex is almost always due to a wrong choice of delimiter. So must we demonstrate that wrong choice ? I agree that the alternative could be another char, like "!". But then the examples using "|" could be changed. Is it worth it ? Anyway, the "." escaped in a character class must be changed, because it would fail using the PCRE_EXTRA (X) modifier (I agree that its not ofted used but still ;) ). ------------------------------------------------------------------------ [2006-02-18 16:05:51] [EMAIL PROTECTED] I'm not sure of the merit of using a different delimiter there since it demonstrates that if the delimiter does exist, it should be escaped. However if it is changed, I think '|' is a bad choice because it's part of PCRE syntax. ------------------------------------------------------------------------ [2006-02-18 16:05:49] [EMAIL PROTECTED] I'm not sure of the merit of using a different delimiter there since it demonstrates that if the delimiter does exist, it should be escaped. However if it is changed, I think '|' is a bad choice because it's part of PCRE syntax. ------------------------------------------------------------------------ [2006-02-18 14:48:34] [EMAIL PROTECTED] Description: ------------ In the manual page of preg_match, "/" is always used as delimiter, even if there are "/"s in the regex. It could influences bad habbits on readers. There are also too many escaped chars. Here is the patch containing the proposed changes: http://www.colder.ch/patches/preg-match.patch ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36442&edit=1