我有一个字符串,我想匹配双方括号的内容: 示例:
<p><span>"Sed ut perspiciatis vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"</span></p><p><span>[[image file="2013-12/5s_1.jpg" alt="IPhone 5s" title="IPhone 5s" ]]</span></p><p><span>[[download file="2013-12/modulo-per-restituzione-prodotti-.pdf" icon="icon" text="" title="Download" ]]</span></p>
结果:
download file="2013-12/module-res.pdf" icon="icon" text="" title="Download"
image file="2013-12/5s_1.jpg" alt="IPhone 5s" title="IPhone 5s"
考虑到这两个字符串可以包含任何类型的字符,我尝试了这个解决方案,但我遇到了其他字符的问题:
\[\[[\w+\s*="-\/]*\]\]