note 72997 added to reference.pcre.pattern.modifiers
| From: | ebarnard at marathonmultimedia dot com | Date: | Tue, 06 Feb 2007 22:35:52 +0000 |
| Subject: | note 72997 added to reference.pcre.pattern.modifiers | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122952@lists.php.net to get a copy of this message | ||
When adding comments with the /x modifier, don't use the pattern delimiter in the comments. It
may not be ignored in the comments area. Example:
<?php
$target = 'some text';
if(preg_match('/
e # Comments here
/x',$target)) {
print "Target 1 hit.\n";
}
if(preg_match('/
e # /Comments here with slash
/x',$target)) {
print "Target 1 hit.\n";
}
?>
prints "Target 1 hit." but then generates a PHP warning message for the second
preg_match():
Warning: preg_match() [function.preg-match]: Unknown modifier 'C' in
/ebarnard/x-modifier.php on line 11
----
Server IP: 64.71.164.2
Probable Submitter: 209.18.139.113
----
Manual Page -- http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php
Edit -- https://master.php.net/note/edit/72997
Del: integrated -- https://master.php.net/note/delete/72997/integrated
Del: useless -- https://master.php.net/note/delete/72997/useless
Del: bad code -- https://master.php.net/note/delete/72997/bad+code
Del: spam -- https://master.php.net/note/delete/72997/spam
Del: non-english -- https://master.php.net/note/delete/72997/non-english
Del: in docs -- https://master.php.net/note/delete/72997/in+docs
Del: other reasons-- https://master.php.net/note/delete/72997
Reject -- https://master.php.net/note/reject/72997
Search -- https://master.php.net/manage/user-notes.php