- 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
怎么让搜索出来的关键字变红色?
高亮搜索词
最新推荐文章于 2024-10-22 18:11:24 发布
本文介绍了一个使用正则表达式来高亮显示字符串中特定单词的方法。通过定义一个函数,可以将匹配到的单词用特定的HTML标签包裹起来,实现视觉上的突出显示效果。
5748

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



