手机靓号AABB,ABAA,AABB等规则的正则表达式

正文

将11位的手机号进行靓号标识,前7位不做特殊判断,后四位进行靓号判断,同时AAAA不允许满足AABB,AAAB,ABAB等情况。

1.尾号AABB:

^[0-9]{7}(\d)\1((?!\1)\d)\2$

2.尾号AAA:

^[0-9]{8}(\d)\1{2}$

3.尾号AAAB:

^[0-9]{7}(\d)\1{2}((?!\1)\d)$

4.尾号ABAB:

^[0-9]{7}(\d)((?!\1)\d)\1\2$

5.尾号AABA:

^[0-9]{7}(\d)\1((?!\1)\d)\1$

6.尾号ABAA:

^[0-9]{7}(\d)((?!\1)\d)\1{2}$

7.尾号ABBA:

^[0-9]{7}(\d)((?!\1)\d)\2\1$

8.尾号ABCC:

^[0-9]{7}(\d)((?!\1)\d)((?!\1|\2)\d)\3$

你可能感兴趣的:(Java)