当前位置: 编程技术>其它
asp正则表达式匹配数字$数字$数字$
来源: 互联网 发布时间:2014-10-14
本文导语: 代码如下:Dim strOk,strNo strOk = "12312321$12312312312$12312321$" strNo = "12312321$12312312312$12312321$sdfsd" Function RegExpTest(patrn, strng) Dim regEx, match, matches ' 建立变量。 Set regEx ...
代码如下:
Dim strOk,strNo
strOk = "12312321$12312312312$12312321$"
strNo = "12312321$12312312312$12312321$sdfsd"
Function RegExpTest(patrn, strng)
Dim regEx, match, matches ' 建立变量。
Set regEx = New RegExp ' 建立规范表达式。
regEx.Pattern = patrn ' 设置模式。
regEx.IgnoreCase = True ' 设置是否区分字母的大小写。
regEx.Global = false ' 设置全程性质。
set matches= regEx.Execute(strng) ' 执行搜索。
for each match in matches ' 重复匹配集合
RetStr=RetStr &"Match found at position "
RetStr=RetStr&Match.FirstIndex&".Match Value is '"
RetStr=RetStr&Match.Value&"'."&vbCRLF
Next
IF Not IsEmpty(matches) And matches(0).Value = strng Then
RegExpTest = true
Else
RegExpTest = false
End IF
End Function
MsgBox(RegExpTest("[d+$]+", strOk))
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。