SoFunction
Updated on 2025-03-03

Mobile phone number, password regular verification

 /**
* phone number
*Mobile: 134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188
* Unicom: 130,131,132,152,155,156,185,186
* Telecom: 133,1349,153,180,189
     */
    NSString * MOBILE = @"^1(3[0-9]|5[0-35-9]|8[025-9])\\d{8}$";
    /**
* China Mobile: China Mobile
              * 134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188
              */
    NSString * CM = @"^1(34[0-8]|(3[5-9]|5[017-9]|8[278])\\d)\\d{7}$";
    /**
* China Unicom: China Unicom
              * 130,131,132,152,155,156,185,186
              */
    NSString * CU = @"^1(3[0-2]|5[256]|8[56])\\d{8}$";
    /**
* China Telecom: China Telecom
              * 133,1349,153,180,189
              */
    NSString * CT = @"^1((33|53|8[09])[0-9]|349)\\d{7}$";
    /**
* Mainland China Landline and Little Lingtong
* Area Code: 010,020,021,022,023,024,025,027,028,029
* Number: Seven or eight digits
              */
    // NSString * PHS = @"^0(10|2[0-5789]|\\d{3})\\d{7,8}$";

password
^(?=.*?[a-zA-Z])(?=.*?[0-9])[a-zA-Z0-9]{6,20}$

"^\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]+)|([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]+)|([0-9]*[1-9][0-9]*)))$"//Negative floating point 
number 
"^(-?\d+)(\.\d+)?$"//Floating point number 
"^[A-Za-z]+$"//A string composed of 26 English letters 
"^[A-Z]+$"//A string composed of 26 English letters capitalization 
"^[a-z]+$"//A string composed of 26 English letters lowercase 
"^[A-Za-z0-9]+$"//A string composed of numbers and 26 English letters 
"^\w+$"//A string composed 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 phone 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 (MobileNo, regPattern); 
  }


Regular expression-Verify mobile phone number: 13[0-9]{9} 
Implement the situation where the mobile phone number is 86 or +86:^((\+86)|(86))?(13)\d{9}$ 
Verify phone number and mobile phone number simultaneously: (^(\d{3,4}-)?\d{7,8})$|(13[0-9]{9}) 
Network links in extracting information: (h|H)(r|R)(e|E)(f|F)  *=  *('|")?(\w|\\\|/|\.)+('|"|  *|>)? 
The email address in the extracted information: \w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* 
Image links in extracting information: (s|S)(r|R)(c|C)  *=  *('|")?(\w|\\\|/|\.)+('|"|  *|>)? 
The IP address in the extracted information: (\d+)\.(\d+)\.(\d+)\.(\d+) 
Chinese mobile phone number in the extracted information: (86)*0*13\d{9} 
Chinese fixed phone number extracted from the information: (\(\d{3,4}\)|\d{3,4}-|\s)?\d{8} 
Extract Chinese phone numbers (including mobile and landline phones) in the information: (\(\d{3,4}\)|\d{3,4}-|\s)?\d{7,14} 
The Chinese postal code in the extracted information: [1-9]{1}(\d+){5} 
The Chinese ID number in the extracted information:\d{18}|\d{15} 
Extract integers in the information: \d+ 
Extract floating point numbers (i.e. decimals) in the information: (-?\d*)\.?\d+ 
Extract any number in the information : (-?\d*)(\.\d+)? 
Extract Chinese strings in the information: [\u4e00-\u9fa5]* 
Extract double-byte string in information (Chinese characters): [^\x00-\xff]*