- result= replace(result,search,"<font color=red>"&search&"</font>")
- '用正则表达式突出显示字符串中查询到的单词的函数
- Function BoldWord(strContent,word)
- if IsNull(strContent) then exit function
- dim objRegExp
- Set objRegExp=new RegExp
- objRegExp.IgnoreCase =true
- objRegExp.Global=True
- objRegExp.Pattern="(" & word & ")"
- strContent=objRegExp.Replace(strContent,"<span style=""color:#ff0000"">$1</span>" )
- Set objRegExp=Nothing
- BoldWord=strContent
- End Function
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
本文介绍了一个使用正则表达式来高亮显示字符串中特定单词的方法。通过定义一个函数,可以将匹配到的单词用特定的HTML标签包裹起来,实现视觉上的突出显示效果。
653

被折叠的 条评论
为什么被折叠?



