note 86705 deleted from function.preg-match by danbrown
| From: | danbrown@php.net | Date: | Thu, 30 Oct 2008 20:46:57 +0000 |
| Subject: | note 86705 deleted from function.preg-match by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-145978@lists.php.net to get a copy of this message | ||
Note Submitter: Jason Ables
Reason: bad code
----
Example #4 is incorrectly listed as:
<?php
$str = 'foobar: 2008';
preg_match('/(?<name>\w+): (?<digit>\d+)/', $str, $matches);
print_r($matches);
?>
The above will produce the following error:
Warning: preg_match() [function.preg-match]: Compilation failed: unrecognized character after (?<
at offset 3
The example should be listed as:
<?php
$str = 'foobar: 2008';
preg_match('/(?P<name>\w+): (?P<digit>\d+)/', $str, $matches);
print_r($matches);
?>