note 53903 added to function.preg-match-all

From: Date: Thu, 16 Jun 2005 13:48:00 +0000
Subject: note 53903 added to function.preg-match-all
Groups: php.notes 
Request: Send a blank email to php-notes+get-90537@lists.php.net to get a copy of this message
By assigning a name to a capturing group, you can easily reference it by name. (?P<name>group) captures the match of group into the backreference "name". You can reference the contents of the group with the numbered backreference or the named backreference <?php preg_match_all('|(a)(?P<x>b)(?P<y>c)(d)|','abcdefgabcdefg',$sub); echo $sub[2][0]; //b echo '<br />'; echo $sub['y'][0]; //c ?> Pablo from Salto, Uruguay ---- Manual Page -- http://www.php.net/manual/en/function.preg-match-all.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53903 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53903&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53903&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53903&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53903&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+53903&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53903&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53903&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90537) next »