note 37343 deleted from function.preg-match by felipe
| From: | felipe@php.net | Date: | Mon, 10 Dec 2007 01:32:11 +0000 |
| Subject: | note 37343 deleted from function.preg-match by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133069@lists.php.net to get a copy of this message | ||
Note Submitter: nospam at 1111-internet dot com
----
Backreferences (ala preg_replace) work within the search string if you use the backslash syntax.
Consider:
<?php
if (preg_match("/([0-9])(.*?)(\\1)/", "01231234", $match))
{
print_r($match);
}
?>
Result: Array ( [0] => 1231 [1] => 1 [2] => 23 [3] => 1 )
This is alluded to in the description of preg_match_all, but worth reiterating here.