我正在尝试提出一个正则表达式,它从以下字符串构造一个看起来像下面的数组
$str = 'Hello world [something here]{optional}{optional}{optional}{n possibilities of this}';
到目前为止我有/^(\*{0,3})(.+)\[(.*)\]((?:{[a-z ]+})?)$/
Array
(
[0] => Array
(
[0] => Hello world [something here]{optional}{optional}{optional}{n possibilities of this}
[1] =>
[2] => Hello world
[3] => something here
[4] => {optional}
[5] => {optional}
[6] => {optional}
[7] => ...
[8] => ...
[9] => {n of this}
)
)
什么是一个好的方法?谢谢