note 73298 added to function.preg-match-all

From: Date: Fri, 16 Feb 2007 17:03:37 +0000
Subject: note 73298 added to function.preg-match-all
Groups: php.notes 
Request: Send a blank email to php-notes+get-123489@lists.php.net to get a copy of this message
Using a capturing group within a group that may occur more than once will only return one backreference , not one for each occurrance of the entire group. ie <?PHP $example = '<atag>foo</atag><atag>bar</atag>'; $regExp = '/(?:<atag>(.*?)<\/atag>)*/'; preg_match_all($regExp,$example,$matches,PREG_SET_ORDER); ?> will return $matches[0][0] = <atag>foo</atag><atag>bar</atag> $matches[0][1] = bar foo is lost. Correct me if I'm wrong. I hope I am. ---- Server IP: 194.145.210.3 Probable Submitter: 89.145.217.161 ---- Manual Page -- http://www.php.net/manual/en/function.preg-match-all.php Edit -- https://master.php.net/note/edit/73298 Del: integrated -- https://master.php.net/note/delete/73298/integrated Del: useless -- https://master.php.net/note/delete/73298/useless Del: bad code -- https://master.php.net/note/delete/73298/bad+code Del: spam -- https://master.php.net/note/delete/73298/spam Del: non-english -- https://master.php.net/note/delete/73298/non-english Del: in docs -- https://master.php.net/note/delete/73298/in+docs Del: other reasons-- https://master.php.net/note/delete/73298 Reject -- https://master.php.net/note/reject/73298 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123489) next »