Re: [pcre] backreferences to all matches of a repeated subexpression

From: Date: Thu, 02 Aug 2007 21:38:28 +0000
Subject: Re: [pcre] backreferences to all matches of a repeated subexpression
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-260100@lists.php.net to get a copy of this message
On Wed, Aug 01, 2007 at 08:05:09PM -0700, Jack Bates wrote: > I'm not sure how to get an array of all subexpression matches, in the > order matches appear in the subject, instead of the order expressions > appear in the pattern. This problem gave me a headache. My only idea is to use preg_split() instead. <?php $foo = preg_split('/\[(.*)\]+|\./U', "foo.bar[ab.cd].baz", -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); var_dump($foo); ?> Seems to work as intended. Hope I could help. Regards Steffen

« previous php.general (#260100) next »