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>