diff --git a/CHANGELOG.md b/CHANGELOG.md index 60d7d742..d8fd8654 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change logs +## 2024.08.27 v5.21.2 + +1. `pattern` support mac/ip4/ip4_pri + ## 2024.08.12 v5.21.1 1. `osVersion` support Harmony diff --git a/README.md b/README.md index 211e3f96..92846761 100644 --- a/README.md +++ b/README.md @@ -254,6 +254,8 @@ declare class Client { Collection of common regular expressions +> v5.21.2 `pattern` support mac/ip4/ip4_pri + - Since: `1.0.1` - Arguments: `none` @@ -288,6 +290,9 @@ declare const pattern: { array: RegExp isjson: RegExp textarea: RegExp + mac: RegExp + ip4: RegExp + ip4_pri: RegExp } ``` @@ -1581,7 +1586,7 @@ declare function parseUrlParam(url: string, covert?: boolean): Record v5.20.0 Breaking change: remove encodeURIComponent +> v5.20.0 Breaking change: remove encodeURIComponent
> v5.21.0 Breaking change: covert support boolean & SpliceUrlParamOptions - Since: `5.3.0` diff --git a/package.json b/package.json index f1960c80..cbdc54c6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "js-cool", "description": "Collection of common JavaScript / TypeScript utilities", - "version": "5.21.1", + "version": "5.21.2", "packageManager": "pnpm@9.1.3", "main": "dist/index.cjs.js", "module": "dist/index.esm-bundler.js", diff --git a/src/pattern.ts b/src/pattern.ts index 8ac9111c..6a6f3da9 100644 --- a/src/pattern.ts +++ b/src/pattern.ts @@ -26,7 +26,11 @@ const pattern = { array: /^\[[\s\S]*\]$/, isjson: /[\s\S]*(\{[\s\S]*\})[\s\S]*/, textarea: - /[\u4E00-\u9FA5_a-zA-Z0-9\,\.\/\?\;\:\'\"\[\]\-\*\(\)\(\)\%\$\@\\\!\,\《\》\。\、\?\;\:\‘\’\“\”\…\¥\!]/ + /[\u4E00-\u9FA5_a-zA-Z0-9\,\.\/\?\;\:\'\"\[\]\-\*\(\)\(\)\%\$\@\\\!\,\《\》\。\、\?\;\:\‘\’\“\”\…\¥\!]/, + mac: /^((([a-f0-9]{2}:){5})|(([a-f0-9]{2}-){5}))[a-f0-9]{2}$/i, + ip4: /^(([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5]).){3}([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])$/, + ip4_pri: + /^1(((0|27)(.(([1-9]?|1[0-9])[0-9]|2([0-4][0-9]|5[0-5])))|(72.(1[6-9]|2[0-9]|3[01])|92.168))(.(([1-9]?|1[0-9])[0-9]|2([0-4][0-9]|5[0-5]))){2})$/ } export default pattern