note 87152 deleted from function.preg-match by danbrown

From: Date: Wed, 03 Aug 2011 13:11:37 +0000
Subject: note 87152 deleted from function.preg-match by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182150@lists.php.net to get a copy of this message
Note Submitter: dbreen at gmail dot com ---- When I was using the above example's syntax for named capturing groups, it worked fine on my development server (PHP 5.2.6), but then gave me a regex error on the live server (PHP 5.0.4). By adding a 'P' in front of the parameter name, it seems to have resolved the issue (this is in accordance w/ the PCRE implementation). To use the above example, here's the original: <?php preg_match('/(?<name>\w+): (?<digit>\d+)/', $str, $matches); ?> And here's the fix: <?php preg_match('/(?P<name>\w+): (?P<digit>\d+)/', $str, $matches); ?>

« previous php.notes (#182150) next »