我问的问题关于正则表达式替换引用,不带引号,引用,不带引号的......在这个线程情况:Regex for quote tags php报价标签的正则表达式PHP - 一般情况下
我意识到我需要保存的物品订购更一般的情况。如引用,不加引号,引用,引用,引用等等......还有没有嵌套引号。我想它应该做迭代或递归...我会解释一下例子。
some unquoted text11
[quote="person1"]some quoted text11[/quote]
[quote="person2"]some quoted text22[/quote]
[quote="person3"]some quoted text33[/quote]
some unquoted text22
...
[quote="person4"]some quoted text44[/quote]
...
结果数组应该是:
Array //PRESERVED ORDER
(
[0] => Array
(
['type'] => unquoted
['name'] => ''
['text'] => some unquoted text11
)
[1] => Array
(
['type'] => quoted
['name'] => person1
['text'] => some quoted text11
)
[2] => Array
(
['type'] => quoted
['name'] => person2
['text'] => some quoted text22
)
[3] => Array
(
['type'] => quoted
['name'] => person3
['text'] => some quoted text33
)
[4] => Array
(
['type'] => unquoted
['name'] => ''
['text'] => some unquoted text22
)
...
[5] => Array
(
['type'] => quoted
['name'] => person4
['text'] => some quoted text44
)
...
}
嘿,你告诉我们你试过什么? – HamZa