Collected regular expressions commonly used in asp.net

Time:2021-12-2

“^ \ D + $” / / non negative integer (positive integer)  +  0)  
“^ [0-9] * [1-9] [0-9] * $” / / positive integer  
“^ (- \ D +)| (0 +) $” / / non positive integer (negative integer)  +  0)  
“^ – [0-9] * [1-9] [0-9] * $” / / negative integer  
“^ -? \ D + $” / / integer  
“^ \ D + (\. \ D +)? $” / / non negative floating point number (positive floating point number)  +  0)  
“^ (([0-9] + \. [0-9] * [1-9] [0-9] *) | ([0-9] * [1-9] [0-9] * \. [0-9] +) | ([0-9] * [1-9] [0-9] *) $” / / positive floating point number  
“^ (- \ D + (\. \ D +)?) | (0 + (\. 0 +)?) $” / / non positive floating point number (negative floating point number)  +  0)  
“^ (- ([0-9] + \. [0-9] * [1-9] [0-9] *) | ([0-9] * [1-9] [0-9] * \. [0-9] +) | ([0-9] * [1-9] [0-9] *)) $” / / negative floating point
number  
“^ (-? \ D +) (\. \ D +)? $” / / floating point number  
“^ [a-za-z] + $” / / a string of 26 English letters  
“^ [A-Z] + $” / / a string composed of 26 uppercase letters  
“^ [A-Z] + $” / / a string composed of 26 lowercase letters  
“^ [a-za-z0-9] + $” / / a string composed of numbers and 26 English letters  
“^ \ W + $” / / a string consisting of numbers, 26 English letters or underscores  
“^ [\ W -] + (\. [\ W -] +) * @ [\ W -] + (\. [\ W -] +) + $” / / email address  
“^[a-zA-z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$”  //url 
/^13 \ d{9} $/ GI mobile number regular expression
public static bool IsValidMobileNo(string MobileNo)
  {
   const string regPattern = @”^(130|131|132|133|134|135|136|137|138|139)\d{8}$”;
   return Regex.IsMatch(MobileNo, regPattern);
  }
Regular expression — verify mobile number: 13 [0-9] {9}
Implementation of mobile phone number with 86 or + 86 in front: ^ ((\ + 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 network links in information: (h|h) (r|r) (e|e) (f|f)   *=  * (‘|”)?(\w|\\|\/|\.)+(‘|”|   *|>)?  
Extract the email address in the information: \ W + ([- +.] \ W +) * @ \ W + ([-.] \ W +) * \. \ W + ([-.] \ W +)*   
Extract picture links in information: (s|s) (r|r) (c|c)   *=  * (‘|”)?(\w|\\|\/|\.)+(‘|”|   *|>)?
IP address in the extracted information: (\ D +) \. (\ D +) \. (\ D +) \. (\ D +) \. (\ D +))     
Extract the Chinese mobile phone number in the information: (86) * 0 * 13 \ d{9}     
Extract the Chinese fixed telephone number in the information: (\ (\ D {3,4} \) | \ D {3,4} – | \ s)\ d{8}     
Extract the Chinese telephone number (including mobile and fixed phones) in the information: (\ (\ D {3,4} \) | \ D {3,4} – | \ s)\ d{7,14}     
China postal code in the extracted information: [1-9] {1} (\ D +) {5}     
The ID number of China in the information extraction: \d{18}|\d{15}     
Extract integers from information: \ D+     
Extract floating point numbers (i.e. decimals) in information: (-? \ d *) \\ d+     
Extract any number in the message   : (-?\d*)(\.\d+)?   
Chinese string in extracted information: [\ u4e00 – \ u9fa5]*     
Extract a double byte string from the message    (Chinese character): [^ \ X00 – \ XFF]*