Java for regular matching instances of phone Numbers

  • 2020-04-01 04:02:19
  • OfStack

This article illustrates a Java method for regular matching of phone Numbers. Share with you for your reference. The details are as follows:


public interface RegExpConst {
 
 String MOBILE = "^1(3[0-9]|5[0-35-9]|8[025-9])\d{8}$";
 
 String CM = "^1(34[0-8]|(3[5-9]|5[017-9]|8[278])\d)\d{7}$";
 
 String CU = "^1(3[0-2]|5[256]|8[56])\d{8}$";
 
 String CT = "^1((33|53|8[09])[0-9]|349)\d{7}$";
 
 String PHS = "^0(10|2[0-5789]|\d{3})\d{7,8}$";
}

PS: here for you to provide two very convenient regular expression tools for your reference:

JavaScript regular expression online testing tool:
(link: http://tools.jb51.net/regex/javascript)

Regular expression online generation tool:
(link: http://tools.jb51.net/regex/create_reg)

I hope this article has been helpful to your Java programming.


Related articles: