最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
实现搜索结果的关键词变色标注的程序(使用正则表达式)
时间:2022-07-02 23:58:22 编辑:袖梨 来源:一聚教程网
<%
' 以前写全文检索程序的时候写的.
' 原创 by 飞鸟@dev-club.com
' Email: [email protected]
' ie5.5 脚本引擎 required
dim patern
dim found
dim str
dim result
patern="(a)|(b)"
str=" A dog fall in love with a cat. Can you believe?"
result=""
call getMatchText(str,result,false)
Response.Write result
sub getMatchText(byref str,byref result,isNeedTrunc)
'on error resume next
Dim regEx, Match, Matches
dim tStr
Set regEx = New RegExp ' 建立正则表达式。
regEx.Pattern = (patern) ' 设置模式。
regEx.IgnoreCase = True ' 设置是否区分字符大小写。
regEx.Global = True ' 设置全局可用性。
Set Matches = regEx.Execute(str) ' 执行搜索。
if err.number<>0 then
response.write "错误1:" & err.description
err.clear
exit sub
end if
' 以前写全文检索程序的时候写的.
' 原创 by 飞鸟@dev-club.com
' Email: [email protected]
' ie5.5 脚本引擎 required
dim patern
dim found
dim str
dim result
patern="(a)|(b)"
str=" A dog fall in love with a cat. Can you believe?"
result=""
call getMatchText(str,result,false)
Response.Write result
sub getMatchText(byref str,byref result,isNeedTrunc)
'on error resume next
Dim regEx, Match, Matches
dim tStr
Set regEx = New RegExp ' 建立正则表达式。
regEx.Pattern = (patern) ' 设置模式。
regEx.IgnoreCase = True ' 设置是否区分字符大小写。
regEx.Global = True ' 设置全局可用性。
Set Matches = regEx.Execute(str) ' 执行搜索。
if err.number<>0 then
response.write "错误1:" & err.description
err.clear
exit sub
end if
相关文章
- jm天堂网页版官方登录入口-jm天堂网页版直接登录入口 12-14
- 蝉妈妈网页版直达入口-蝉妈妈app官方正版入口在哪 12-14
- 豆包AI智能在线网页解析神器-豆包AI智能在线会议纪要生成助手 12-14
- 小红书Web官网登录入口-小红书官方网页版一键登录 12-14
- 苍云阅读app如何快速找到目录-目录入口位置 12-14
- 苹果ID登录官网入口 - 苹果Apple ID账户登录页面一键直达 12-14