我想使用RegEx替换标签内的标签
<script>alert('this is a sample alert <script>document.write(getURLParameter('model'))</script> and some other text here');</script>
到
<script>alert('this is a sample alert " + getURLParameter('model') + " and some other text here');</script>
我有超过1,000个文件需要使用Dreamweaver进行更正&#34;查找和替换&#34; &#34;使用正则表达式&#34;匹配所有事件
答案 0 :(得分:0)
查找(<script>[\s\S]+?)(<script>document.write\()([\s\S]+?)(\)<\/script>)([\s\S]+?<\/script>)
替换为$1" + $3 + "$5
编辑:还包括document.write
答案 1 :(得分:0)
像这样的东西。从你的例子中很难说出什么不变。
查找:
(?s)(<script>.*?)<script>.*?\((.+?)\)</script>(.*?</script>)
替换:
$1' + $2 + '$3