加入收藏 | 设为首页 | 会员中心 | 我要投稿 银川站长网 (https://www.0951zz.com/)- 云通信、基础存储、云上网络、机器学习、视觉智能!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

ASP正则表达式窍门

发布时间:2023-05-20 12:37:24 所属栏目:Asp教程 来源:
导读:ASP正则表达式秘诀:代码如下:<%str = request("str")reg = request("reg")set regex = new RegExpWith regex.Pattern = reg.IgnoreCase = False.Global = TrueEnd WithSet match = regex.Execute(str)If match.Coun

ASP正则表达式秘诀:

代码如下:

<%

str = request("str")

reg = request("reg")

set regex = new RegExp

With regex

.Pattern = reg

.IgnoreCase = False

.Global = True

End With

Set match = regex.Execute(str)

If match.Count > 0 Then

For Each matched in match

Response.Write "<B><input value=" & matched.Value & " ></B> 位置: <B>" & matched.FirstIndex & "</B> 长

度:"&matched.Length&"<BR>"

Next

Else

Response.Write "<B>" & regex.Pattern & "</B> 没有找到匹配"

End If

Set regex = nothing

%>

<form method=post>

text:<br>

<textarea cols=50 rows=10 name="str"><%=str%></textarea><br>

regexp:<input name="reg" value="<%=reg%>"><br>

<input type=submit value="regexp">

</form>

关于具体的正则表达式函数

//www.Cuoxin.com/article/20816.htm

(编辑:银川站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章