ASP extract the content of mobile phone number, QQ, URL of regular code _ regular expression

Source: Internet
Author: User
Common Regular matching expressions

Regular expression--verification of mobile phone number: 13[0-9]{9}
To achieve the mobile phone number 86 or +86 before: ^ (\+86) | (86))? (\d{9}$)
The phone number and mobile number are verified simultaneously: (^ (\d{3,4}-) \d{7,8}) $| (13[0-9]{9})
To extract the network links in the information: (h| H) (r| R) (e| E) (f| F) *= * (' | ')? (\w|\\|\/|\.) +('|"| *|>)?
Message address in the extraction information: \w+ ([-+.] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) *
Extract picture links in information: (s| S) (r| R) (c| C) *= * (' | ')? (\w|\\|\/|\.) +('|"| *|>)?
Extract the IP address in the information: (\d+) \. (\d+) \. (\d+) \. (\d+)
China Mobile phone number to extract information: (*0*13\D{9)
Extract Chinese fixed phone number in information: (\ (\d{3,4}\) |\d{3,4}-|\s)? \d{8}
Extract the Chinese phone number (including mobile and landline) in the information:(\ (\d{3,4}\) |\d{3,4}-|\s)? \d{7,14}
China Post Code in Extract information: [1-9]{1} (\d+) {5}
Chinese identity card number in the extraction of information: \d{18}|\d{15}
To extract an integer from the information: \d+
Extract floating-point numbers (that is, decimals) in the information: (-?\d*) \.? \d+
Extract any number in the information: (-?\d*) (\.\d+)?
Extract the Chinese string in the information: [\u4e00-\u9fa5]*
Extract a double-byte string (kanji) from the information: [^\x00-\xff]*

The function to use (the first argument is a regular expression and the second is a string):
Copy Code code as follows:

Function regexptest (patrn, strng)
Dim regEx, Match, matches ' create variable. The
Set regEx = New RegExp ' establishes a regular expression.
Regex.pattern = Patrn ' Set mode.
Regex.ignorecase = True ' Sets whether character case is case-sensitive.
Regex.global = True ' Sets global availability.
Set matches = Regex.execute (strng) ' performs a search. The
for each match in matches ' traverses the matching collection.
' retstr = retstr & Match found at position '
' retstr = retstr & Match.firstindex & '. Match Value is '
Retstr = retstr & match.value
Next
regexptest = retstr
End Function
/div>
Related Article

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.