用正则表达式突出显示字符串中查询到的单词的函数

圧(Windows Script 5.丵谋謃郕輚?
Function BoldWord(strContent,word)
dim objRegExp
Set objRegExp=new RegExp
objRegExp.IgnoreCase =true
objRegExp.Global=True

objRegExp.Pattern="(" & word & ")"
strContent=objRegExp.Replace(strContent,"<font color=""#FF0000"">$1</font>" )

Set objRegExp=Nothing
BoldWord=strContent
End Function

Published At
Categories with Web编程
Tagged with
comments powered by Disqus