The example of this article tells the method of Java's regular matching of the phone number. Share it for everyone for your reference. The specifics are as follows:
Public Interface Regexpconst { /*** Mobile Number* Mobile: 134 [0-8], 135,136,137,139,150,157,158,159,187,188* Unicom: 130,132,152,155, 156,185,186 * Telecom: 133,1349,153,180,189 */ String Mobile = "^1 (3 [0-9] | 5 [0-35-9] | 8 [025-9]) // D {8} $ ";/** * China Mobile: China Mobile * 134 [0-8], 135,136,137,139,150,157,159,187,188 */String 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 */String Cu = "^1 (3 [0-2] | 5 [256] | 8 [56]) // d {8} $";/** * China Telecom: China Telecom * 133,1349,1349 , 153,180,189*/string CT = "^1 ((33 | 53 | 8 [09]) [0-9] | 349) // d {7} $"; Area code: 010,020,021,022,023,024,027,028,029 * Number: Seven or eight-bit */String PHS = "^0 (10 | 2 [0-5789] | // d {3}) // d {7,8} $";}
PS: Here is another two very convenient regular expression tools for everyone for your reference:
JavaScript regular expression online testing tool:
http://tools.vevb.com/regex/javascript
Regular expression online generation tool:
http://tools.vevb.com/regex/create_reg
It is hoped that this article is helpful to everyone's Java program design.