正则表达式匹配标签中的内容
这里提供四种方式:根据自己的需要选择即可
//1、
string regexJs = "(?<=<script(.*?)>)(.|\n)*?(?=</script>)"
//2、
string regexJs = "(?<=<script(.)*?>)([\\s\\S](?!<script))*?(?=</script>)"
//3、
string regexJs = "<script.*?>[\\s.]*?</script>";
//4、实测:我自己用的这一种
string regexJs = "(<script(.*?)>)(.|\n)*?(</script>)";
本文介绍了四种不同的正则表达式技巧,帮助你精确提取HTML标签内容,包括<script>标签的匹配。无论是基本的括号捕获组,还是更复杂的零宽断言,都提供了实用的解决方案。
1348

被折叠的 条评论
为什么被折叠?



