@scaleway/regex 2.5.1 → 2.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,166 +3,112 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## 2.5.1 (2022-09-19)
6
+ ## 2.5.3 (2022-11-17)
7
7
 
8
- **Note:** Version bump only for package @scaleway/regex
8
+ ### Bug Fixes
9
9
 
10
+ - cron regex ([#1079](https://github.com/scaleway/scaleway-lib/issues/1079)) ([deb52ae](https://github.com/scaleway/scaleway-lib/commit/deb52aead1ff5ec81c443ca8a7f737c822a3da36))
10
11
 
12
+ ## 2.5.2 (2022-09-23)
11
13
 
14
+ **Note:** Version bump only for package @scaleway/regex
12
15
 
16
+ ## 2.5.1 (2022-09-19)
13
17
 
14
- ## 2.5.0 (2022-09-13)
18
+ **Note:** Version bump only for package @scaleway/regex
15
19
 
20
+ ## 2.5.0 (2022-09-13)
16
21
 
17
22
  ### Features
18
23
 
19
- * **regex:** add cidr regex ([#982](https://github.com/scaleway/scaleway-lib/issues/982)) ([dc32290](https://github.com/scaleway/scaleway-lib/commit/dc3229007463f7f1ab5267a2efd9851bb629b625))
20
-
21
-
24
+ - **regex:** add cidr regex ([#982](https://github.com/scaleway/scaleway-lib/issues/982)) ([dc32290](https://github.com/scaleway/scaleway-lib/commit/dc3229007463f7f1ab5267a2efd9851bb629b625))
22
25
 
23
26
  ## 2.4.0 (2022-09-08)
24
27
 
25
-
26
28
  ### Features
27
29
 
28
- * **regex:** add ip regexes ([#972](https://github.com/scaleway/scaleway-lib/issues/972)) ([98c6ded](https://github.com/scaleway/scaleway-lib/commit/98c6deda557af0cd41b1a6064946af2dea6680c2))
29
-
30
-
30
+ - **regex:** add ip regexes ([#972](https://github.com/scaleway/scaleway-lib/issues/972)) ([98c6ded](https://github.com/scaleway/scaleway-lib/commit/98c6deda557af0cd41b1a6064946af2dea6680c2))
31
31
 
32
32
  ## 2.3.0 (2022-08-01)
33
33
 
34
-
35
34
  ### Features
36
35
 
37
- * add new regex `alphaDashes` to the list ([#901](https://github.com/scaleway/scaleway-lib/issues/901)) ([608f823](https://github.com/scaleway/scaleway-lib/commit/608f8230badb68dcbcb5eab95c1661f97652a042))
38
-
39
-
36
+ - add new regex `alphaDashes` to the list ([#901](https://github.com/scaleway/scaleway-lib/issues/901)) ([608f823](https://github.com/scaleway/scaleway-lib/commit/608f8230badb68dcbcb5eab95c1661f97652a042))
40
37
 
41
38
  ### 2.2.3 (2022-04-26)
42
39
 
43
-
44
40
  ### Bug Fixes
45
41
 
46
- * **regex:** improve url regex ([#736](https://github.com/scaleway/scaleway-lib/issues/736)) ([c340227](https://github.com/scaleway/scaleway-lib/commit/c340227da34141c978237e7659404df84e680d7a))
47
-
48
-
42
+ - **regex:** improve url regex ([#736](https://github.com/scaleway/scaleway-lib/issues/736)) ([c340227](https://github.com/scaleway/scaleway-lib/commit/c340227da34141c978237e7659404df84e680d7a))
49
43
 
50
44
  ### 2.2.2 (2022-04-05)
51
45
 
52
46
  **Note:** Version bump only for package @scaleway/regex
53
47
 
54
-
55
-
56
-
57
-
58
48
  ### 2.2.1 (2022-03-11)
59
49
 
60
50
  **Note:** Version bump only for package @scaleway/regex
61
51
 
62
-
63
-
64
-
65
-
66
52
  ## 2.2.0 (2022-01-19)
67
53
 
68
-
69
54
  ### Features
70
55
 
71
- * add alphaLower and basicDomain regex ([#600](https://github.com/scaleway/scaleway-lib/issues/600)) ([418bda9](https://github.com/scaleway/scaleway-lib/commit/418bda9db7c3c342565e01433461d78079bb1b76))
72
-
73
-
56
+ - add alphaLower and basicDomain regex ([#600](https://github.com/scaleway/scaleway-lib/issues/600)) ([418bda9](https://github.com/scaleway/scaleway-lib/commit/418bda9db7c3c342565e01433461d78079bb1b76))
74
57
 
75
58
  ## 2.1.0 (2021-11-23)
76
59
 
77
-
78
60
  ### Features
79
61
 
80
- * add absolute path regex ([#514](https://github.com/scaleway/scaleway-lib/issues/514)) ([f271d72](https://github.com/scaleway/scaleway-lib/commit/f271d7251198f2119480a02dce844a283452e061))
81
-
82
-
62
+ - add absolute path regex ([#514](https://github.com/scaleway/scaleway-lib/issues/514)) ([f271d72](https://github.com/scaleway/scaleway-lib/commit/f271d7251198f2119480a02dce844a283452e061))
83
63
 
84
64
  ## 2.0.0 (2021-07-20)
85
65
 
86
-
87
66
  ### ⚠ BREAKING CHANGES
88
67
 
89
- * migrate the codebase to typescript
68
+ - migrate the codebase to typescript
90
69
 
91
70
  ### Code Refactoring
92
71
 
93
- * migrate to typescript ([#272](https://github.com/scaleway/scaleway-lib/issues/272)) ([3923c68](https://github.com/scaleway/scaleway-lib/commit/3923c68d6f7feadee7e2e30e32c9ef5d1f3003b9))
94
-
95
-
72
+ - migrate to typescript ([#272](https://github.com/scaleway/scaleway-lib/issues/272)) ([3923c68](https://github.com/scaleway/scaleway-lib/commit/3923c68d6f7feadee7e2e30e32c9ef5d1f3003b9))
96
73
 
97
74
  ### 1.4.3 (2021-05-11)
98
75
 
99
76
  **Note:** Version bump only for package @scaleway/regex
100
77
 
101
-
102
-
103
-
104
-
105
78
  ### 1.4.2 (2021-05-10)
106
79
 
107
80
  **Note:** Version bump only for package @scaleway/regex
108
81
 
109
-
110
-
111
-
112
-
113
82
  ### 1.4.1 (2021-04-15)
114
83
 
115
-
116
84
  ### Bug Fixes
117
85
 
118
- * add hexa regex ([#130](https://github.com/scaleway/scaleway-lib/issues/130)) ([a67e2e6](https://github.com/scaleway/scaleway-lib/commit/a67e2e65db928816bfa745bcf6f9631811e7640d))
119
-
120
-
86
+ - add hexa regex ([#130](https://github.com/scaleway/scaleway-lib/issues/130)) ([a67e2e6](https://github.com/scaleway/scaleway-lib/commit/a67e2e65db928816bfa745bcf6f9631811e7640d))
121
87
 
122
88
  # 1.4.0 (2021-03-12)
123
89
 
124
-
125
90
  ### Features
126
91
 
127
- * add mac address regex ([#67](https://github.com/scaleway/scaleway-lib/issues/67)) ([a4d8c83](https://github.com/scaleway/scaleway-lib/commit/a4d8c8300f1d8503ca0f8bbfbb8a4595fc24123c))
128
-
129
-
130
-
131
-
92
+ - add mac address regex ([#67](https://github.com/scaleway/scaleway-lib/issues/67)) ([a4d8c83](https://github.com/scaleway/scaleway-lib/commit/a4d8c8300f1d8503ca0f8bbfbb8a4595fc24123c))
132
93
 
133
94
  ## [1.3.1](https://github.com/scaleway/scaleway-lib/compare/@scaleway/regex@1.3.0...@scaleway/regex@1.3.1) (2021-02-15)
134
95
 
135
96
  **Note:** Version bump only for package @scaleway/regex
136
97
 
137
-
138
-
139
-
140
-
141
98
  # [1.3.0](https://github.com/scaleway/scaleway-lib/compare/@scaleway/regex@1.2.0...@scaleway/regex@1.3.0) (2021-02-15)
142
99
 
143
-
144
100
  ### Features
145
101
 
146
- * **eslint:** enable not yet enabled react plugin rules from airbnb ([#27](https://github.com/scaleway/scaleway-lib/issues/27)) ([78c9692](https://github.com/scaleway/scaleway-lib/commit/78c9692fe56ca308e49fb1bb9ac80b5a6217a6f3))
147
-
148
-
149
-
150
-
102
+ - **eslint:** enable not yet enabled react plugin rules from airbnb ([#27](https://github.com/scaleway/scaleway-lib/issues/27)) ([78c9692](https://github.com/scaleway/scaleway-lib/commit/78c9692fe56ca308e49fb1bb9ac80b5a6217a6f3))
151
103
 
152
104
  # 1.2.0 (2021-01-28)
153
105
 
154
-
155
106
  ### Features
156
107
 
157
- * **regex:** add deploy package ([b288c6f](https://github.com/scaleway/scaleway-lib/commit/b288c6f06bd6107064f5ea74acb2207954ec08e2))
158
-
159
-
160
-
161
-
108
+ - **regex:** add deploy package ([b288c6f](https://github.com/scaleway/scaleway-lib/commit/b288c6f06bd6107064f5ea74acb2207954ec08e2))
162
109
 
163
110
  # 1.1.0 (2020-11-09)
164
111
 
165
-
166
112
  ### Features
167
113
 
168
- * **regex:** add deploy package ([7fd5f83](https://github.com/scaleway/scaleway-lib/commit/7fd5f83f31737dc11946bb9bcbd16cf443c4af0d))
114
+ - **regex:** add deploy package ([7fd5f83](https://github.com/scaleway/scaleway-lib/commit/7fd5f83f31737dc11946bb9bcbd16cf443c4af0d))
@@ -14,10 +14,12 @@ const alphanumSpacesDotsUnderscoreDash = /^[a-zA-Z0-9-.\s_]*$/;
14
14
  const alphanumUnderscoreDash = /^[a-zA-Z0-9_-]*$/;
15
15
  const alphanumUnderscoreDollarDash = /^[a-zA-Z0-9_$-]*$/;
16
16
  const absoluteLinuxPath = /(^\/$|^(\/[a-zA-Z0-9_]+)*$)/;
17
+
17
18
  const ascii = /^[\x00-\x7F]+$/;
18
19
  const backupKey = /^[A-Z0-9]{32}$/;
19
20
  const basicDomain = /^[a-z0-9-]+(\.[a-z0-9-]{1,63})+$/;
20
- const cron = /^[0-9,/*-]+$/;
21
+ const uppercaseBasicDomain = /^(?![-])+[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,63})+$/;
22
+ const cron = /^((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})$/;
21
23
  const digits = /^[0-9]*$/;
22
24
  const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;
23
25
  const email = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
@@ -27,6 +29,7 @@ const spaces = /^\s*$/;
27
29
  const sixDigitsCode = /^[0-9]{6}$/;
28
30
  const url = /^http(s)?:\/\/?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/;
29
31
  const hexadecimal = /^[0-9a-fA-F]+$/;
32
+
30
33
  const v4 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}';
31
34
  const v6segment = '[a-fA-F\\d]{1,4}';
32
35
  const v6 = `
@@ -41,6 +44,7 @@ const v6 = `
41
44
  (?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:))
42
45
  )(?:%[0-9a-zA-Z]{1,})?
43
46
  `.replace(/\s*\/\/.*$/gm, '').replace(/\n/g, '').trim();
47
+
44
48
  const cidrv4 = `${v4}\\/(3[0-2]|[12]?[0-9])`;
45
49
  const cidrv6 = `${v6}\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])`;
46
50
  const ip = new RegExp(`^(?:${v4}|${v6})$`);
@@ -50,4 +54,4 @@ const ipCidr = new RegExp(`(?:^${cidrv4}$)|(?:^${cidrv6}$)`);
50
54
  const ipv4Cidr = new RegExp(`^${cidrv4}$`);
51
55
  const ipv6Cidr = new RegExp(`^${cidrv6}$`);
52
56
 
53
- export { absoluteLinuxPath, alpha, alphaDashes, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdots, ascii, backupKey, basicDomain, cron, digits, email, fourDigitsCode, hexadecimal, ip, ipCidr, ipv4, ipv4Cidr, ipv6, ipv6Cidr, macAddress, phone, sixDigitsCode, spaces, url };
57
+ export { absoluteLinuxPath, alpha, alphaDashes, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdots, ascii, backupKey, basicDomain, cron, digits, email, fourDigitsCode, hexadecimal, ip, ipCidr, ipv4, ipv4Cidr, ipv6, ipv6Cidr, macAddress, phone, sixDigitsCode, spaces, uppercaseBasicDomain, url };
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ declare const absoluteLinuxPath: RegExp;
17
17
  declare const ascii: RegExp;
18
18
  declare const backupKey: RegExp;
19
19
  declare const basicDomain: RegExp;
20
+ declare const uppercaseBasicDomain: RegExp;
20
21
  declare const cron: RegExp;
21
22
  declare const digits: RegExp;
22
23
  declare const macAddress: RegExp;
@@ -34,4 +35,4 @@ declare const ipCidr: RegExp;
34
35
  declare const ipv4Cidr: RegExp;
35
36
  declare const ipv6Cidr: RegExp;
36
37
 
37
- export { absoluteLinuxPath, alpha, alphaDashes, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdots, ascii, backupKey, basicDomain, cron, digits, email, fourDigitsCode, hexadecimal, ip, ipCidr, ipv4, ipv4Cidr, ipv6, ipv6Cidr, macAddress, phone, sixDigitsCode, spaces, url };
38
+ export { absoluteLinuxPath, alpha, alphaDashes, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdots, ascii, backupKey, basicDomain, cron, digits, email, fourDigitsCode, hexadecimal, ip, ipCidr, ipv4, ipv4Cidr, ipv6, ipv6Cidr, macAddress, phone, sixDigitsCode, spaces, uppercaseBasicDomain, url };
package/dist/index.js CHANGED
@@ -14,10 +14,12 @@ const alphanumSpacesDotsUnderscoreDash = /^[a-zA-Z0-9-.\s_]*$/;
14
14
  const alphanumUnderscoreDash = /^[a-zA-Z0-9_-]*$/;
15
15
  const alphanumUnderscoreDollarDash = /^[a-zA-Z0-9_$-]*$/;
16
16
  const absoluteLinuxPath = /(^\/$|^(\/[a-zA-Z0-9_]+)*$)/;
17
+
17
18
  const ascii = /^[\x00-\x7F]+$/;
18
19
  const backupKey = /^[A-Z0-9]{32}$/;
19
20
  const basicDomain = /^[a-z0-9-]+(\.[a-z0-9-]{1,63})+$/;
20
- const cron = /^[0-9,/*-]+$/;
21
+ const uppercaseBasicDomain = /^(?![-])+[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,63})+$/;
22
+ const cron = /^((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})$/;
21
23
  const digits = /^[0-9]*$/;
22
24
  const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;
23
25
  const email = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
@@ -27,6 +29,7 @@ const spaces = /^\s*$/;
27
29
  const sixDigitsCode = /^[0-9]{6}$/;
28
30
  const url = /^http(s)?:\/\/?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/;
29
31
  const hexadecimal = /^[0-9a-fA-F]+$/;
32
+
30
33
  const v4 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}';
31
34
  const v6segment = '[a-fA-F\\d]{1,4}';
32
35
  const v6 = `
@@ -41,6 +44,7 @@ const v6 = `
41
44
  (?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:))
42
45
  )(?:%[0-9a-zA-Z]{1,})?
43
46
  `.replace(/\s*\/\/.*$/gm, '').replace(/\n/g, '').trim();
47
+
44
48
  const cidrv4 = `${v4}\\/(3[0-2]|[12]?[0-9])`;
45
49
  const cidrv6 = `${v6}\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])`;
46
50
  const ip = new RegExp(`^(?:${v4}|${v6})$`);
@@ -50,4 +54,4 @@ const ipCidr = new RegExp(`(?:^${cidrv4}$)|(?:^${cidrv6}$)`);
50
54
  const ipv4Cidr = new RegExp(`^${cidrv4}$`);
51
55
  const ipv6Cidr = new RegExp(`^${cidrv6}$`);
52
56
 
53
- export { absoluteLinuxPath, alpha, alphaDashes, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdots, ascii, backupKey, basicDomain, cron, digits, email, fourDigitsCode, hexadecimal, ip, ipCidr, ipv4, ipv4Cidr, ipv6, ipv6Cidr, macAddress, phone, sixDigitsCode, spaces, url };
57
+ export { absoluteLinuxPath, alpha, alphaDashes, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdots, ascii, backupKey, basicDomain, cron, digits, email, fourDigitsCode, hexadecimal, ip, ipCidr, ipv4, ipv4Cidr, ipv6, ipv6Cidr, macAddress, phone, sixDigitsCode, spaces, uppercaseBasicDomain, url };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/regex",
3
- "version": "2.5.1",
3
+ "version": "2.5.3",
4
4
  "description": "A small utility to use regex",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -18,5 +18,5 @@
18
18
  "directory": "packages/regex"
19
19
  },
20
20
  "license": "MIT",
21
- "gitHead": "c490670e375bfd964b7fbbf8506ac9e3893ec669"
21
+ "gitHead": "ad81bfc131adaa1e198e9d19cd1b2f0ace0934d9"
22
22
  }