当前位置: 移动技术网 > IT编程>开发语言>正则 > asp正则表达式匹配数字$数字$数字$

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

2017年12月12日  | 移动技术网IT编程  | 我要评论
    
复制代码 代码如下:

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

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网