我写ASP时常用到的一些函数(2)
'//过滤脏话函数Function ChkBadWords(fString,BadWords)dim bwords bwords = split(BadWords, "|") for i = 0 to ubound(bwords) fString = Replace(fString, bwords(i), string(len(bwords(i)),"*"), 1,-1,1) nextChkBadWords = fStringEnd Function'用正则表达式突出显示字符串中查询到的单词的函数Function BoldWord(strContent,word) dim objRegExp Set objRegExp=new RegExp objRegExp.IgnoreCase =true objRegExp.Global=TrueobjRegExp.Pattern="(" & word & ")" strContent=objRegExp.Replace(strContent,"<font color=""#ff0000"">$1</font>" )
Set objRegExp=Nothing BoldWord=strContent End Function
补充:asp教程,高级应用