ASP regular expression matches the number $$

Time:2021-9-25

    

Copy codeThe code is as follows:
Dim strOk,strNo 
    strOk = “12312321$12312312312$12312321$” 
    strNo = “12312321$12312312312$12312321$sdfsd” 

    Function RegExpTest(patrn, strng) 
         Dim   regEx,   match,   matches    ‘  Create variables.  
         Set   regEx  =  New   RegExp    ‘  Create a canonical expression.  
         regEx.Pattern  =  patrn    ‘  Set the mode.  
         regEx.IgnoreCase  =  True    ‘  Sets whether letters are case sensitive.  
         regEx.Global  =  false    ‘  Set the nature of the whole process.  
         set   matches=   regEx.Execute(strng)    ‘  Perform a search.  
         for   each   match   in   matches       ‘  Duplicate matching set  
            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))