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