note 41026 deleted from pcre.pattern.syntax by vincent
| From: | vincent@php.net | Date: | Sat, 27 Mar 2004 09:07:31 +0000 |
| Subject: | note 41026 deleted from pcre.pattern.syntax by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-67229@lists.php.net to get a copy of this message | ||
Note Submitter: squeegee
----
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.