0
请帮我解决这个问题。preg_match_all获取HTML中的链接,样式和脚本标记
我的代码是:
preg_match_all('/<(link|style|script)(.*?)(\/>|<\/style>|<\/script>)/i', $tpl_content, $styles);
它不会,如果有 '>' 链接标签结束时,如果链接标签结束与 '/>'
谢谢你的工作(只工作
请帮我解决这个问题。preg_match_all获取HTML中的链接,样式和脚本标记
我的代码是:
preg_match_all('/<(link|style|script)(.*?)(\/>|<\/style>|<\/script>)/i', $tpl_content, $styles);
它不会,如果有 '>' 链接标签结束时,如果链接标签结束与 '/>'
谢谢你的工作(只工作
不知道,如果你想标记之间的一切,嗯,这是在未拍摄组在此:
/(<(?:link|style|script)(?:.*?)(?:\/)?>)(?:(?<=^|>)[^><]+?(?=<|$))(<\/(?:style|script)>)?/i
我会在这个顺便使用PREG_SET_ORDER标志。 [0]是全部匹配,[1]是开始/全部,并且[2]是可选的结束标记
$string = '<link lan="hello"/><script language=\'javascript\'>$(document).ready(function() {}</script>'
$returnValue = preg_match_all('/(<(?:link|style|script)(?:.*?)(?:\\/)?>)(?:(?<=^|>)[^><]+?(?=<|$))(<\\/(?:style|script)>)?/i', $string , $matches, PREG_SET_ORDER);