Asp regular expression match number $

Source: Internet
Author: User

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 'to create a variable.
Set regEx = New RegExp 'to create a regular expression.
RegEx. Pattern = patrn 'setting mode.
RegEx. IgnoreCase = true' specifies whether to distinguish uppercase and lowercase letters.
RegEx. Global = false' sets the full nature.
Set matches = regEx. Execute (strng) 'to Execute the search.
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 ))

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.