On Wed, 2009-09-09 at 18:18 +0200, Jan Reiter wrote: > Good Afternoon. > > > > This shouldn't be too complicated, but I can't come up with a solution for > the problem right now. It's about RegEx in PHP (5.2) > > > > Is there a way to capture ALL sub elements of an expression like > preg_match('@a(?[0-9])*b@' ,"a2345678b" , $matches); ?? > > This would produce (below) whereas I'd like to get all the elements (2-8) as > an array entry each . ([1]=>2, [2]=>3 .) > > > > Result: > > array(2) { > > [0]=> > > array(1) { > > [0]=> > > string(9) "a2345678b" > > } > > [1]=> > > array(1) { > > [0]=> > > string(1) "8" > > } > > } > > > > preg_match_all doesn't do the trick. > > > > The Expression I want to use is > > > > @prim_states[\s]*\((?<num>[0-9\s]*)(prim_state[\s]*\((?<flag>[a-fA-F0-9\s]*) > tex_idxs[\s]*\(([0-9\s]*)\)([0-9\s]*)\)[\s]*)*\)@ > > > > as I'm trying to parse a 3d Model File, that contains data in the form of > > > > prim_states ( 51 > > prim_state ( 00000000 2 > > tex_idxs ( 1 2 ) 0 3 0 0 1 > > ) > > prim_state ( 00000000 3 > > tex_idxs ( 1 2 ) 0 0 1 0 1 > > ) > > prim_state ( 00000000 3 > > tex_idxs ( 1 2 ) 0 4 1 0 1 > > ) > > [.] > > ) > > > > Thank You! > > > > Regards, > > Jan > > If your example is indicative of what you need, then couldn't you just loop through all the elements inside of the match as it will be a contiguous string of numbers. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php