备份
This commit is contained in:
11
filter/js.go
Normal file
11
filter/js.go
Normal file
@ -0,0 +1,11 @@
|
||||
package filter
|
||||
|
||||
import "regexp"
|
||||
|
||||
// FilterScriptTags 使用正则表达式过滤 HTML 文本中的 <script> 标签(不区分大小写)
|
||||
func FilterScriptTags(input string) string {
|
||||
// 正则表达式匹配 <script> 标签及其内容,不区分大小写
|
||||
re := regexp.MustCompile(`(?i)<script[^>]*>.*?</script>`)
|
||||
// 替换匹配的部分为空字符串
|
||||
return re.ReplaceAllString(input, "")
|
||||
}
|
Reference in New Issue
Block a user