2017-04-19 23 views

回答

0

如何:

preg_match_all("/<script.*type=\"(?!text\/x-template).*>(.*)<\/script>/im", $input_lines, $output_array); 

看到它在行動: http://www.phpliveregex.com/p/jOB

+1

另外請注意,你應該準備它的CA當script標籤沒有type屬性時。 – ARS81

-1

我解決了它。

/(\s*)<script(?![ \t\r\n]+type\s*=\s*"\s*text\/x\-template\s*").*?(\b[^>]*?>)([\s\S]*?)<\/script>(\s*)/ 

https://jsfiddle.net/porizm/6wrebz23/8/

+0

看看這個問題,爲什麼你不應該使用正則表達式來解決這個問題http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags – delboy1978uk

相關問題