This article describes how to use regular expressions to verify the latest phone number segments, including 150, 158, 159, and 188. For more information, see. Previously, programmer's house introduced some regular expressions used to verify mobile phone numbers. for example, php matches the regular expression of phone numbers (location, live video number, and extension number supported) regular expressions are commonly used in php (date phones, Chinese mailboxes, etc.). However, the mobile phone number is now added to the section 150,153,156,158,159,157,188,189 and so on. here we will add the relevant regular expressions. As follows: Code example: string s = @ "^ (13 [0-9] | 15 [0 | 3 | 6 | 7 | 8 | 9] | 18 [8 | 9]) \ d {8} $ ";Then add 180,147 and so on: Code example: ^ (1 ([35] [0-9]) | (47) | [8] [0126789]) \ d {8} $Modify the 183 and add the landline as follows: Code example: Mobile phone: ^ (1 ([35] [0-9]) | (47) | [8] [01236789]) \ d {8} $ landline: ^ 0 \ d {2, 3 }(\-)? \ D {7, 8} $The following describes two regular expressions used in php and java to verify the mobile phone number. 1, php version Sample code: 2, java Sample code:Using System; using System. Collections. Generic; using System. Text; using System. Text. RegularExpressions; using System. Windows. Forms; Namespace ConsoleApplication1 {class Program {static void Main (string [] args) {// string s = @ "^ (13 [0-9] | 15 [0 | 3 | 6 | 8 | 9]) \ d {8} $ "; String s = @ "^ (13 [0-9] | 15 [0 | 3 | 6 | 7 | 8 | 9] | 18 [8 | 9]) \ d {8} $ "; while (true) {string input = Console. readLine (); if (Regex. isMatch (input, s) {MessageBox. show ("fully compliant! ");} Else {MessageBox. Show (" No! ");}}}}} |