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

Time:2021-1-12

Common regular matching expressions

Regular expression — verify mobile phone number: 13 [0-9] {9}
The implementation of 86 or + 86 in front of mobile phone number: ^ ((\ + 86) | (86))? (13) d {9}$
Simultaneous verification of phone number and mobile phone number: (^ (< D {3,4} -)? (D {7,8}) $| (13 [0-9] {9})
Extract the network links in the information: (H | h) (R | R) (E | E) (f | f) * = * (‘| “)? ((w | \ \ | / |) + (‘ |” | * | >)?
Extract the e-mail address in the information: W + ([-.] – W +) * @ \ W + ([-.] – W +) * \. [-.] – W + ([-.] – W +))*
Extract the image links in the information: (s | s) (R | R) (C | C) * = * (‘|)? ([w | \ \ | / |) + (‘ | “| * | >)?
Extract the IP address in the information: (- D +) \. (- D +) \. (- D +) \. (- D +) \. (- D +))
Extract Chinese mobile phone number from information: (86) * 0 * 13 {D {9}
Extract the fixed telephone number of China in the information: (\ \ (< D {3,4}) | [D {3,4} – | [s)? D {8}
Extract the Chinese telephone number (including mobile and fixed telephone) in the information: (\ \ (< D {3,4}) | [D {3,4} – | [s)? D {7,14}
Extract the postcode of China in the information: [1-9] {1} (\ D +) {5}
The ID number of China in the information extraction: \d{18}|\d{15}
Extract integers in information: D+
Extract floating-point numbers (i.e. decimals) in information: (-? – D *) \.? – D+
Extract any number in the information: (-? – D *) (\. [D +)?
Extract the Chinese character string in the information: [u4e00 – [u9fa5]*
Extract the double byte string (Chinese character) in the information: [^ X00 – [XFF]*

Function used (the first parameter is regular expression and the second is string)

Copy codeThe code is as follows:
Function RegExpTest(patrn, strng)
Dim regex, match, matches’ create variables.
Set regex = new regexp’creates a regular expression.
regEx.Pattern =PATRN ‘setting mode.
regEx.IgnoreCase =True ‘sets whether characters are case sensitive.
regEx.Global =True ‘sets global availability.
Set Matches = regEx.Execute (strng) ‘to perform the search.
For each match in matches’.
‘RetStr = RetStr & “Match found at position ”
‘RetStr = RetStr & Match.FirstIndex & “. Match Value is ‘”
RetStr = RetStr & Match.Value
Next
RegExpTest = RetStr
End Function