下面这个,过滤掉了
怎样保留[img]这个不被过滤。只要这一个。objRegExp.Pattern = "([[a-zA-Z].*?])|([[\/][a-zA-Z].*?])" '
strOutput = objRegExp.Replace(strHtml, "") '将html标签去掉
strOutput = Replace(strOutput, "[", "[") '防止非html标签不显示
strOutput = Replace(strOutput, "]", "]")
怎样保留[img]这个不被过滤。只要这一个。objRegExp.Pattern = "([[a-zA-Z].*?])|([[\/][a-zA-Z].*?])" '
strOutput = objRegExp.Replace(strHtml, "") '将html标签去掉
strOutput = Replace(strOutput, "[", "[") '防止非html标签不显示
strOutput = Replace(strOutput, "]", "]")
测试发现全都没过滤了。ubb代码全部显示了。
我只要[img]不被过滤
var objRegExp=/\[\\?(?!img\b)[a-zA-Z].*?\]/;另外你写的是vbscript?
html = html.replace(/\[\/?(?!img)[^\]]*\]/g,"");
alert(html);
Dim objRegExp, strOutput
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "([(?!img\])[A-Z].*?])|([[\/][a-z].*?])"
strOutput = objRegExp.Replace(strHtml, "")
strOutput = Replace(strOutput, "[", "[")
strOutput = Replace(strOutput, "]", "]")
delHtml = strOutput
Set objRegExp = Nothing
End Function
------------------------------------------
Content=delHtml(Rs("Content"))
parent=Rs("parent")
if instr(Content,"[img]")>0 Then
Content="分享了图片"
end if
strHtml = "[a][b][b]test[\b]"
Set objRegExp = new RegExp
objRegExp.Pattern = "\[\\?(?!img\b)[a-zA-Z].*?\]" '
objRegExp.Global = True
strOutput = objRegExp.Replace(strHtml, "") '将html标签去掉
MsgBox strOutput
</script>