首页 > Web开发 > 详细

asp正则表达式匹配数字$数字$数字$

时间:2016-01-02 22:00:48      阅读:138      评论:0      收藏:0      [点我收藏+]
    
复制代码 代码如下:

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))

asp正则表达式匹配数字$数字$数字$

原文:http://www.jb51.net/article/14279.htm

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!