Regular codes of mobile phone numbers, qq numbers, and URLs extracted by asp

Source: Internet
Author: User

Common Regular Expression

Regular Expression -- verify mobile phone number: 13 [0-9] {9}
If the mobile phone number is 86 or + 86 before it is implemented: ^ (\ + 86) | (86 ))? (13) \ d {9} $
Verify the phone number and phone number at the same time: (^ (\ d {3, 4 }-)? \ D {7, 8}) $ | (13 [0-9] {9 })
Extract the network link in the information: (h | H) (r | R) (e | E) (f | F) * = * ('| ")? (\ W | \/| \.) + ('| "| * |> )?
Email Address in the extracted information: \ w + ([-+.] \ w +) * @ \ w + ([-.] \ w + )*\. \ w + ([-.] \ w + )*
Extract the image link in the information: (s | S) (r | R) (c | C) * = * ('| ")? (\ W | \/| \.) + ('| "| * |> )?
Extract the IP address in the information: (\ d +) \. (\ d +)
Extract the Chinese mobile phone number from the information: (86) * 0*13 \ d {9}
Extracted Chinese landline numbers from the information: (\ d {3, 4} \) | \ d {3, 4}-| \ s )? \ D {8}
Extract Chinese phone numbers (including mobile and landline phones) from the Information: (\ d {3, 4} \) | \ d {3, 4}-| \ s )? \ D {7, 14}
Extracted Chinese zip code: [1-9] {1} (\ d +) {5}
Chinese ID card number in the extracted information: \ d {18} | \ d {15}
Extract the integer \ d + from the information.
Extract floating point numbers (decimal places) in the Information ):(-? \ D *)\.? \ D +
Extract any number from the information :(-? \ D *) (\. \ d + )?
Extract the Chinese string from the information: [\ u4e00-\ u9fa5] *
Double-byte string (Chinese character) in the extracted information: [^ \ x00-\ xff] *

Function used (the first parameter is a regular expression and the second parameter is a string ):
Copy codeThe Code is as follows:
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 the characters are case sensitive.
RegEx. Global = true' to set Global availability.
Set Matches = regEx. Execute (strng) 'to Execute the search.
For Each Match in Matches 'traverses the matching set.
'Retstr = RetStr & "Match found at position"
'Retstr = RetStr & Match. FirstIndex & ". Match Value is '"
RetStr = RetStr & Match. Value
Next
RegExpTest = RetStr
End Function

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.