Skip to content

Commit

Permalink
Merge pull request #29 from VincentSit/patch-1441
Browse files Browse the repository at this point in the history
Add support for 1441 prefix.
  • Loading branch information
VincentSit authored May 5, 2020
2 parents 4ddaa27 + 05c631c commit b5f62eb
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 41 deletions.
29 changes: 15 additions & 14 deletions POSIX-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@
这些转义字符并不是正则表达式所需要的。在您修改正则表达式的时候请多加小心。
为了防止渲染出现错误,所有的正则表达式都需要在注释中写清转义之前的语句。
参见 https://help.github.com/articles/organizing-information-with-tables/#formatting-content-within-your-table
-->

<!--
| GNU ERE | `^(+?86)?1(3[0-9]{3}|5[01235-9][0-9]{2}|8[0-9]{3}|7([0-35-9][0-9]{2}|4(0[0-9]|1[0-2]|9[0-9]))|9[0-35-9][0-9]{2}|6[2567][0-9]{2}|4([14]0[0-9]{3}|[68][0-9]{4}|[579][0-9]{2}))[0-9]{6}$` |
| GNU BRE | `^\(+\?86\)\?1\(3[0-9]\{3\}\|5[01235-9][0-9]\{2\}\|8[0-9]\{3\}\|7\([0-35-9][0-9]\{2\}\|4\(0[0-9]\|1[0-2]\|9[0-9]\)\)\|9[0-35-9][0-9]\{2\}\|6[2567][0-9]\{2\}\|4\([14]0[0-9]\{3\}\|[68][0-9]\{4\}\|[579][0-9]\{2\}\)\)[0-9]\{6\}$` |
| GNU ERE | `^(+?86)?1(3[0-9]{3}|5[01235-9][0-9]{2}|8[0-9]{3}|7([0-35-9][0-9]{2}|4(0[0-9]|1[0-2]|9[0-9]))|9[0-35-9][0-9]{2}|6[2567][0-9]{2}|4((10|4[01])[0-9]{3}|[68][0-9]{4}|[579][0-9]{2}))[0-9]{6}$` |
| GNU BRE | `^\(+\?86\)\?1\(3[0-9]\{3\}\|5[01235-9][0-9]\{2\}\|8[0-9]\{3\}\|7\([0-35-9][0-9]\{2\}\|4\(0[0-9]\|1[0-2]\|9[0-9]\)\)\|9[0-35-9][0-9]\{2\}\|6[2567][0-9]\{2\}\|4\((10|4[01])[0-9]\{3\}\|[68][0-9]\{4\}\|[579][0-9]\{2\}\)\)[0-9]\{6\}$`
-->

| 命令 | 正则表达式 |
| --- | --- |
| GNU ERE | `^(+?86)?1(3[0-9]{3}\|5[01235-9][0-9]{2}\|8[0-9]{3}\|7([0-35-9][0-9]{2}\|4(0[0-9]\|1[0-2]\|9[0-9]))\|9[0-35-9][0-9]{2}\|6[2567][0-9]{2}\|4([14]0[0-9]{3}\|[68][0-9]{4}\|[579][0-9]{2}))[0-9]{6}$` |
| GNU BRE | `^\(+\?86\)\?1\(3[0-9]\{3\}\\|5[01235-9][0-9]\{2\}\\|8[0-9]\{3\}\\|7\([0-35-9][0-9]\{2\}\\|4\(0[0-9]\\|1[0-2]\\|9[0-9]\)\)\\|9[0-35-9][0-9]\{2\}\\|6[2567][0-9]\{2\}\\|4\([14]0[0-9]\{3\}\\|[68][0-9]\{4\}\\|[579][0-9]\{2\}\)\)[0-9]\{6\}$` |
| GNU ERE | `^(+?86)?1(3[0-9]{3}\|5[01235-9][0-9]{2}\|8[0-9]{3}\|7([0-35-9][0-9]{2}\|4(0[0-9]\|1[0-2]\|9[0-9]))\|9[0-35-9][0-9]{2}\|6[2567][0-9]{2}\|4((10\|4[01])[0-9]{3}\|[68][0-9]{4}\|[579][0-9]{2}))[0-9]{6}$` |
| GNU BRE | `^\(+\?86\)\?1\(3[0-9]\{3\}\\|5[01235-9][0-9]\{2\}\\|8[0-9]\{3\}\\|7\([0-35-9][0-9]\{2\}\\|4\(0[0-9]\\|1[0-2]\\|9[0-9]\)\)\\|9[0-35-9][0-9]\{2\}\\|6[2567][0-9]\{2\}\\|4\(\(10\\|4[01]\)[0-9]\{3\}\\|[68][0-9]\{4\}\\|[579][0-9]\{2\}\)\)[0-9]\{6\}$` |

### 匹配所有支持短信功能的号码(手机卡 + 上网卡)

Expand Down Expand Up @@ -84,8 +85,8 @@

| 命令 | 正则表达式 |
| --- | --- |
| GNU ERE | `^(+?86)?1(3[0-2]\|[578][56]\|66|96)[0-9]{8}$` |
| GNU BRE | `^\(+\?86\)\?1\(3[0-2]\\|[578][56]\\|66|96\)[0-9]\{8\}$` |
| GNU ERE | `^(+?86)?1(3[0-2]\|[578][56]\|66\|96)[0-9]{8}$` |
| GNU BRE | `^\(+\?86\)\?1\(3[0-2]\\|[578][56]\\|66\\|96\)[0-9]\{8\}$` |

#### 匹配中国电信

Expand Down Expand Up @@ -190,26 +191,26 @@
#### 匹配所有

<!--
| GNU ERE | `^(+?86)?14([14]0|[68][0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\([14]0\|[68][0-9]\)[0-9]\{9\}$` |
| GNU ERE | `^(+?86)?14([14]0|41|[68][0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\([14]0\|41\|[68][0-9]\)[0-9]\{9\}$` |
-->

| 命令 | 正则表达式 |
| --- | --- |
| GNU ERE | `^(+?86)?14([14]0\|[68][0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\([14]0\\|[68][0-9]\)[0-9]\{9\}$` |
| GNU ERE | `^(+?86)?14([14]0\|41\|[68][0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\([14]0\\|41\\|[68][0-9]\)[0-9]\{9\}$` |

#### 匹配中国移动

<!--
| GNU ERE | `^(+?86)?14(40|8[0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\(40\|8[0-9]\)[0-9]\{9\}$` |
| GNU ERE | `^(+?86)?14(4[01]|8[0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\(4[01]\|8[0-9]\)[0-9]\{9\}$` |
-->

| 命令 | 正则表达式 |
| --- | --- |
| GNU ERE | `^(+?86)?14(40\|8[0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\(40\\|8[0-9]\)[0-9]\{9\}$` |
| GNU ERE | `^(+?86)?14(4[01]\|8[0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\(4[01]\\|8[0-9]\)[0-9]\{9\}$` |

#### 匹配中国联通

Expand Down
30 changes: 15 additions & 15 deletions POSIX.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ See https://help.github.com/articles/organizing-information-with-tables/#formatt
-->

<!--
| GNU ERE | `^(+?86)?1(3[0-9]{3}|5[01235-9][0-9]{2}|8[0-9]{3}|7([0-35-9][0-9]{2}|4(0[0-9]|1[0-2]|9[0-9]))|9[0-35-9][0-9]{2}|6[2567][0-9]{2}|4([14]0[0-9]{3}|[68][0-9]{4}|[579][0-9]{2}))[0-9]{6}$` |
| GNU BRE | `^\(+\?86\)\?1\(3[0-9]\{3\}\|5[01235-9][0-9]\{2\}\|8[0-9]\{3\}\|7\([0-35-9][0-9]\{2\}\|4\(0[0-9]\|1[0-2]\|9[0-9]\)\)\|9[0-35-9][0-9]\{2\}\|6[2567][0-9]\{2\}\|4\([14]0[0-9]\{3\}\|[68][0-9]\{4\}\|[579][0-9]\{2\}\)\)[0-9]\{6\}$` |
| GNU ERE | `^(+?86)?1(3[0-9]{3}|5[01235-9][0-9]{2}|8[0-9]{3}|7([0-35-9][0-9]{2}|4(0[0-9]|1[0-2]|9[0-9]))|9[0-35-9][0-9]{2}|6[2567][0-9]{2}|4((10|4[01])[0-9]{3}|[68][0-9]{4}|[579][0-9]{2}))[0-9]{6}$` |
| GNU BRE | `^\(+\?86\)\?1\(3[0-9]\{3\}\|5[01235-9][0-9]\{2\}\|8[0-9]\{3\}\|7\([0-35-9][0-9]\{2\}\|4\(0[0-9]\|1[0-2]\|9[0-9]\)\)\|9[0-35-9][0-9]\{2\}\|6[2567][0-9]\{2\}\|4\((10|4[01])[0-9]\{3\}\|[68][0-9]\{4\}\|[579][0-9]\{2\}\)\)[0-9]\{6\}$`
-->

| Command | Regular Expression |
| --- | --- |
| GNU ERE | `^(+?86)?1(3[0-9]{3}\|5[01235-9][0-9]{2}\|8[0-9]{3}\|7([0-35-9][0-9]{2}\|4(0[0-9]\|1[0-2]\|9[0-9]))\|9[0-35-9][0-9]{2}\|6[2567][0-9]{2}\|4([14]0[0-9]{3}\|[68][0-9]{4}\|[579][0-9]{2}))[0-9]{6}$` |
| GNU BRE | `^\(+\?86\)\?1\(3[0-9]\{3\}\\|5[01235-9][0-9]\{2\}\\|8[0-9]\{3\}\\|7\([0-35-9][0-9]\{2\}\\|4\(0[0-9]\\|1[0-2]\\|9[0-9]\)\)\\|9[0-35-9][0-9]\{2\}\\|6[2567][0-9]\{2\}\\|4\([14]0[0-9]\{3\}\\|[68][0-9]\{4\}\\|[579][0-9]\{2\}\)\)[0-9]\{6\}$` |
| GNU ERE | `^(+?86)?1(3[0-9]{3}\|5[01235-9][0-9]{2}\|8[0-9]{3}\|7([0-35-9][0-9]{2}\|4(0[0-9]\|1[0-2]\|9[0-9]))\|9[0-35-9][0-9]{2}\|6[2567][0-9]{2}\|4((10\|4[01])[0-9]{3}\|[68][0-9]{4}\|[579][0-9]{2}))[0-9]{6}$` |
| GNU BRE | `^\(+\?86\)\?1\(3[0-9]\{3\}\\|5[01235-9][0-9]\{2\}\\|8[0-9]\{3\}\\|7\([0-35-9][0-9]\{2\}\\|4\(0[0-9]\\|1[0-2]\\|9[0-9]\)\)\\|9[0-35-9][0-9]\{2\}\\|6[2567][0-9]\{2\}\\|4\(\(10\\|4[01]\)[0-9]\{3\}\\|[68][0-9]\{4\}\\|[579][0-9]\{2\}\)\)[0-9]\{6\}$` |

### Match all numbers with SMS (Phone number + Data only number)

Expand Down Expand Up @@ -87,8 +87,8 @@ See https://help.github.com/articles/organizing-information-with-tables/#formatt

| Command | Regular Expression |
| --- | --- |
| GNU ERE | `^(+?86)?1(3[0-2]\|[578][56]\|66|96)[0-9]{8}$` |
| GNU BRE | `^\(+\?86\)\?1\(3[0-2]\\|[578][56]\\|66|96\)[0-9]\{8\}$` |
| GNU ERE | `^(+?86)?1(3[0-2]\|[578][56]\|66\|96)[0-9]{8}$` |
| GNU BRE | `^\(+\?86\)\?1\(3[0-2]\\|[578][56]\\|66\\|96\)[0-9]\{8\}$` |

#### Match China Telecom

Expand All @@ -109,7 +109,7 @@ See https://help.github.com/articles/organizing-information-with-tables/#formatt
| GNU BRE | `^\(+\?86\)\?192[0-9]\{8\}$` |
-->

| 命令 | 正则表达式 |
| Command | Regular Expression |
| --- | --- |
| GNU ERE | `^(+?86)?192[0-9]{8}$` |
| GNU BRE | `^\(+\?86\)\?192[0-9]\{8\}$` |
Expand Down Expand Up @@ -193,26 +193,26 @@ See https://help.github.com/articles/organizing-information-with-tables/#formatt
#### Match all

<!--
| GNU ERE | `^(+?86)?14([14]0|[68][0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\([14]0\|[68][0-9]\)[0-9]\{9\}$` |
| GNU ERE | `^(+?86)?14([14]0|41|[68][0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\([14]0\|41\|[68][0-9]\)[0-9]\{9\}$` |
-->

| Command | Regular Expression |
| --- | --- |
| GNU ERE | `^(+?86)?14([14]0\|[68][0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\([14]0\\|[68][0-9]\)[0-9]\{9\}$` |
| GNU ERE | `^(+?86)?14([14]0\|41\|[68][0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\([14]0\\|41\\|[68][0-9]\)[0-9]\{9\}$` |

#### Match China Mobile

<!--
| GNU ERE | `^(+?86)?14(40|8[0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\(40\|8[0-9]\)[0-9]\{9\}$` |
| GNU ERE | `^(+?86)?14(4[01]|8[0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\(4[01]\|8[0-9]\)[0-9]\{9\}$` |
-->

| Command | Regular Expression |
| --- | --- |
| GNU ERE | `^(+?86)?14(40\|8[0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\(40\\|8[0-9]\)[0-9]\{9\}$` |
| GNU ERE | `^(+?86)?14(4[01]\|8[0-9])[0-9]{9}$` |
| GNU BRE | `^\(+\?86\)\?14\(4[01]\\|8[0-9]\)[0-9]\{9\}$` |

#### Match China Unicom

Expand Down
15 changes: 9 additions & 6 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
###### 如果你需要 POSIX 标准的正则表达式,[点击这里](/POSIX-CN.md)

### 匹配所有号码(手机卡 + 数据卡 + 上网卡)
[`^(?:\+?86)?1(?:3\d{3}|5[^4\D]\d{2}|8\d{3}|7(?:[0-35-9]\d{2}|4(?:0\d|1[0-2]|9\d))|9[0-35-9]\d{2}|6[2567]\d{2}|4(?:[14]0\d{3}|[68]\d{4}|[579]\d{2}))\d{6}$`][匹配所有号码(手机卡 + 数据卡 + 上网卡)]
[`^(?:\+?86)?1(?:3\d{3}|5[^4\D]\d{2}|8\d{3}|7(?:[0-35-9]\d{2}|4(?:0\d|1[0-2]|9\d))|9[0-35-9]\d{2}|6[2567]\d{2}|4(?:(?:10|4[01])\d{3}|[68]\d{4}|[579]\d{2}))\d{6}$`][匹配所有号码(手机卡 + 数据卡 + 上网卡)]

### 匹配所有支持短信功能的号码(手机卡 + 上网卡)
[`^(?:\+?86)?1(?:3\d{3}|5[^4\D]\d{2}|8\d{3}|7(?:[0-35-9]\d{2}|4(?:0\d|1[0-2]|9\d))|9[0-35-9]\d{2}|6[2567]\d{2}|4[579]\d{2})\d{6}$`][匹配所有支持短信功能的号码(手机卡 + 上网卡)]
Expand Down Expand Up @@ -56,10 +56,10 @@
### 物联网数据卡

#### 匹配所有
[`^(?:\+?86)?14(?:[14]0|[68]\d)\d{9}$`][匹配所有物联网数据卡]
[`^(?:\+?86)?14(?:[14]0|41|[68]\d)\d{9}$`][匹配所有物联网数据卡]

#### 匹配中国移动
[`^(?:\+?86)?14(?:40|8\d)\d{9}$`][匹配物联网中国移动]
[`^(?:\+?86)?14(?:4[01]|8\d)\d{9}$`][匹配物联网中国移动]

#### 匹配中国联通
[`^(?:\+?86)?146\d{10}$`][匹配物联网中国联通]
Expand Down Expand Up @@ -122,7 +122,7 @@ https://www.debuggex.com (PCRE 在线视觉化)

| 运营商 <sup>[1]<sup/> | 号段 |
| --- | --- |
| 中国移动 | 1440X / 148XX |
| 中国移动 | 1440X / 1441X / 148XX |
| 中国联通 | 146XX |
| 中国电信 | 1410X |

Expand Down Expand Up @@ -152,6 +152,9 @@ https://www.debuggex.com (PCRE 在线视觉化)

## 更新日志

#### 2020.05.03
- 添加 1441 号段支持。

#### 2020.04.16
- 添加 192 号段支持。

Expand Down Expand Up @@ -206,7 +209,7 @@ MIT

[PCRE]: https://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions

[匹配所有号码(手机卡 + 数据卡 + 上网卡)]: https://www.debuggex.com/r/OLNV3F0jAxT_6ToW
[匹配所有号码(手机卡 + 数据卡 + 上网卡)]: https://www.debuggex.com/r/dwRbKIxaFfBEIkxh

[匹配所有支持短信功能的号码(手机卡 + 上网卡)]: https://www.debuggex.com/r/IivlZsRjoXSX_FJ3

Expand All @@ -232,7 +235,7 @@ MIT

[匹配虚拟运营商中国电信]: https://www.debuggex.com/r/j22iLshKfI_avga-

[匹配所有物联网数据卡]: https://www.debuggex.com/r/95embzRGAR76zPIV
[匹配所有物联网数据卡]: https://www.debuggex.com/r/paDEMqjp1F5dM40F

[匹配物联网中国移动]: https://www.debuggex.com/r/lVn_7eMXVOEiXXK_

Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The mobile number portability(MNP) service in mainland China has been officially
###### If you need POSIX standard regular expressions, [Click here](/POSIX.md).

### Match all numbers (Phone number + IoT number + Data only number)
[`^(?:\+?86)?1(?:3\d{3}|5[^4\D]\d{2}|8\d{3}|7(?:[0-35-9]\d{2}|4(?:0\d|1[0-2]|9\d))|9[0-35-9]\d{2}|6[2567]\d{2}|4(?:[14]0\d{3}|[68]\d{4}|[579]\d{2}))\d{6}$`][Match all numbers (Phone number + IoT number + Data only number)]
[`^(?:\+?86)?1(?:3\d{3}|5[^4\D]\d{2}|8\d{3}|7(?:[0-35-9]\d{2}|4(?:0\d|1[0-2]|9\d))|9[0-35-9]\d{2}|6[2567]\d{2}|4(?:(?:10|4[01])\d{3}|[68]\d{4}|[579]\d{2}))\d{6}$`][Match all numbers (Phone number + IoT number + Data only number)]

### Match all numbers with SMS (Phone number + Data only number)
[`^(?:\+?86)?1(?:3\d{3}|5[^4\D]\d{2}|8\d{3}|7(?:[0-35-9]\d{2}|4(?:0\d|1[0-2]|9\d))|9[0-35-9]\d{2}|6[2567]\d{2}|4[579]\d{2})\d{6}$`][Match all numbers with SMS (Phone number + Data only number)]
Expand Down Expand Up @@ -58,10 +58,10 @@ The mobile number portability(MNP) service in mainland China has been officially
### IoT number

#### Match all
[`^(?:\+?86)?14(?:[14]0\d|[68]\d{2})\d{8}$`][Match IoT]
[`^(?:\+?86)?14(?:[14]0|41|[68]\d)\d{9}$`][Match IoT]

#### Match China Mobile
[`^(?:\+?86)?14(?:40|8\d)\d{9}$`][Match IoT China Mobile]
[`^(?:\+?86)?14(?:4[01]|8\d)\d{9}$`][Match IoT China Mobile]

#### Match China Unicom
[`^(?:\+?86)?146\d{10}$`][Match IoT China Unicom]
Expand Down Expand Up @@ -124,7 +124,7 @@ https://www.debuggex.com (PCRE visualizer)

| Carrier <sup>[1]<sup/> | Prefix |
| --- | --- |
| China Mobile | 1440X / 148XX |
| China Mobile | 1440X / 1441X / 148XX |
| China Unicom | 146XX |
| China Telecom | 1410X |

Expand Down Expand Up @@ -155,6 +155,9 @@ Since the mobile phone number regular expression is time-sensitive, when any reg

## Release Notes

#### May 3, 2020
- Add support for 1441 prefix.

#### April 16, 2020
- Add support for 192 prefix.

Expand Down Expand Up @@ -209,7 +212,7 @@ MIT

[PCRE]: https://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions

[Match all numbers (Phone number + IoT number + Data only number)]: https://www.debuggex.com/r/OLNV3F0jAxT_6ToW
[Match all numbers (Phone number + IoT number + Data only number)]: https://www.debuggex.com/r/dwRbKIxaFfBEIkxh

[Match all numbers with SMS (Phone number + Data only number)]: https://www.debuggex.com/r/IivlZsRjoXSX_FJ3

Expand All @@ -235,7 +238,7 @@ MIT

[Match MVNO China Telecom]: https://www.debuggex.com/r/j22iLshKfI_avga-

[Match IoT]: https://www.debuggex.com/r/95embzRGAR76zPIV
[Match IoT]: https://www.debuggex.com/r/paDEMqjp1F5dM40F

[Match IoT China Mobile]: https://www.debuggex.com/r/lVn_7eMXVOEiXXK_

Expand Down

0 comments on commit b5f62eb

Please sign in to comment.