I have the following regex:
\[([^ -\]]+)( - ([^ -\]]+))+\]
This corresponds to the following result:
[abc - def - ghi - jkl]
BUT the match corresponds to:
Array ( [0] => [abc - def - ghi - jkl] [1] => abc [2] => - jkl [3] => jkl )
I need something like this:
Array ( [0] => [abc - def - ghi - jkl] [1] => abc [2] => - def [3] => def [4] => - ghi [5] => ghi [6] => - jkl [7] => jkl )
I can do this in C # by looking at groups of "captures." How can I do this in PHP?
carlosdubusm
source share