diff --git a/regular/index.d.ts b/regular/index.d.ts index c14003c..cc447be 100644 --- a/regular/index.d.ts +++ b/regular/index.d.ts @@ -46,4 +46,9 @@ export const STRONG_PASSWORD: RegExp; /** * 匹配完整的HTML标签,包括开始标签和结束标签。 */ -export const HTML_TAG: RegExp; \ No newline at end of file +export const HTML_TAG: RegExp; + +/** + * 匹配中国大陆的邮政编码。 + */ +export const POSTAL_CODE: RegExp; diff --git a/regular/index.js b/regular/index.js index 1d7b7bf..b9f0a4f 100644 --- a/regular/index.js +++ b/regular/index.js @@ -54,3 +54,8 @@ export const STRONG_PASSWORD * 匹配完整的HTML标签,包括开始标签和结束标签。 */ export const HTML_TAG = /<[^>]*>/g; + +/** + * 匹配中国大陆的邮政编码。 + */ +export const POSTAL_CODE = /^(0[1-7]|1[0-356]|2[0-7]|3[0-6]|4[0-7]|5[1-7]|6[1-7]|7[0-5]|8[013-6])\d{4}$/g;