PHP 正则表达式组捕获
我有以下正则表达式:
\[([^ -\]]+)( - ([^ -\]]+))+\]
这已成功匹配以下内容:
[abc - def - ghi - jkl]
但匹配是:
Array
(
[0] => [abc - def - ghi - jkl]
[1] => abc
[2] => - jkl
[3] => jkl
)
我需要的是这样的东西:
Array
(
[0] => [abc - def - ghi - jkl]
[1] => abc
[2] => - def
[3] => def
[4] => - ghi
[5] => ghi
[6] => - jkl
[7] => jkl
)
我能够在C#中查看组“捕获”来执行此操作。如何在PHP中执行此操作?