note 53903 deleted from function.preg-match-all by colder

From: Date: Mon, 16 Apr 2007 16:59:06 +0000
Subject: note 53903 deleted from function.preg-match-all by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-125462@lists.php.net to get a copy of this message
Note Submitter: pablo dot seb at gmail dot com ---- 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

« previous php.notes (#125462) next »