note 41026 added to pcre.pattern.syntax
| From: | squeegee at rn2 dot php dot net | Date: | Sat, 27 Mar 2004 08:07:34 +0000 |
| Subject: | note 41026 added to pcre.pattern.syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67223@lists.php.net to get a copy of this message | ||
It took me quite a bit of trial and error to figure out how to match double punctuation characters
at the start of a string, especially if it was $$. I don't know why, but on WinXP for me at the
console (4.3.4RC3-dev), it matters which kind of quote you use around the delimiters.
Example code:
<?php
echo "\r\n";
$testline='$$hello';
if(preg_match("/^([\W_])\1/",$testline))echo "true\r\n";
else echo "false\r\n";
if(preg_match('/^([\W_])\1/',$testline))echo "true\r\n";
else echo "false\r\n";
?>
produces
false
true
I just checked this (changed the slash-r slash-n's to br's) on my web server (4.3.3) and
the result is the same.
----
Manual Page -- http://www.php.net/manual/en/pcre.pattern.syntax.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41026
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41026&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41026&report=yes
Search -- http://master.php.net/manage/user-notes.php