正则表达式在PHP中搜索多个匹配项
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了正则表达式在PHP中搜索多个匹配项相关的知识,希望对你有一定的参考价值。
This will search for specific type of tag in html doc and extract type attribute value and all attributes after it in tag.
$data = '<html> <body> <jdoc:include type="head" name="popup" style="raw" /> <jdoc:include type="modules" name="dochead" style="raw" /> </body> </html>'; { Will return $matches = [0][0] = "<jdoc:include type="head" name="popup" style="raw" />" [0][1] = "<jdoc:include type="modules" name="dochead" style="raw" />" [1][0] = head [1][1] = modules [2][0] = name="popup" style="raw" [2][1] = name="dochead" style="raw" }
以上是关于正则表达式在PHP中搜索多个匹配项的主要内容,如果未能解决你的问题,请参考以下文章
Python - 使用正则表达式查找多个匹配项并将它们打印出来[重复]