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

<%
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

strContent="你是一个大坏蛋"
word="坏蛋"
response.write(""&BoldWord (strContent,word)&"")
%>

300*300
 文章首页关于迷茫时代关于我写意人生
版权所有:迷茫时代 All rights reserved   
执行时间:0.00389 秒