@scaleway/regex 2.5.2 → 2.6.0

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,174 +3,118 @@
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.2 (2022-09-23)
6
+ ## 2.6.0 (2022-11-29)
7
7
 
8
- **Note:** Version bump only for package @scaleway/regex
8
+ ### Features
9
9
 
10
+ - **regex:** add s3 bucket name regex ([#1093](https://github.com/scaleway/scaleway-lib/issues/1093)) ([deff2ca](https://github.com/scaleway/scaleway-lib/commit/deff2ca550807f2195184ec1f529ec1b3170b4d4))
10
11
 
12
+ ## 2.5.3 (2022-11-17)
11
13
 
14
+ ### Bug Fixes
12
15
 
16
+ - cron regex ([#1079](https://github.com/scaleway/scaleway-lib/issues/1079)) ([deb52ae](https://github.com/scaleway/scaleway-lib/commit/deb52aead1ff5ec81c443ca8a7f737c822a3da36))
13
17
 
14
- ## 2.5.1 (2022-09-19)
18
+ ## 2.5.2 (2022-09-23)
15
19
 
16
20
  **Note:** Version bump only for package @scaleway/regex
17
21
 
22
+ ## 2.5.1 (2022-09-19)
18
23
 
19
-
20
-
24
+ **Note:** Version bump only for package @scaleway/regex
21
25
 
22
26
  ## 2.5.0 (2022-09-13)
23
27
 
24
-
25
28
  ### Features
26
29
 
27
- * **regex:** add cidr regex ([#982](https://github.com/scaleway/scaleway-lib/issues/982)) ([dc32290](https://github.com/scaleway/scaleway-lib/commit/dc3229007463f7f1ab5267a2efd9851bb629b625))
28
-
29
-
30
+ - **regex:** add cidr regex ([#982](https://github.com/scaleway/scaleway-lib/issues/982)) ([dc32290](https://github.com/scaleway/scaleway-lib/commit/dc3229007463f7f1ab5267a2efd9851bb629b625))
30
31
 
31
32
  ## 2.4.0 (2022-09-08)
32
33
 
33
-
34
34
  ### Features
35
35
 
36
- * **regex:** add ip regexes ([#972](https://github.com/scaleway/scaleway-lib/issues/972)) ([98c6ded](https://github.com/scaleway/scaleway-lib/commit/98c6deda557af0cd41b1a6064946af2dea6680c2))
37
-
38
-
36
+ - **regex:** add ip regexes ([#972](https://github.com/scaleway/scaleway-lib/issues/972)) ([98c6ded](https://github.com/scaleway/scaleway-lib/commit/98c6deda557af0cd41b1a6064946af2dea6680c2))
39
37
 
40
38
  ## 2.3.0 (2022-08-01)
41
39
 
42
-
43
40
  ### Features
44
41
 
45
- * 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))
46
-
47
-
42
+ - 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))
48
43
 
49
44
  ### 2.2.3 (2022-04-26)
50
45
 
51
-
52
46
  ### Bug Fixes
53
47
 
54
- * **regex:** improve url regex ([#736](https://github.com/scaleway/scaleway-lib/issues/736)) ([c340227](https://github.com/scaleway/scaleway-lib/commit/c340227da34141c978237e7659404df84e680d7a))
55
-
56
-
48
+ - **regex:** improve url regex ([#736](https://github.com/scaleway/scaleway-lib/issues/736)) ([c340227](https://github.com/scaleway/scaleway-lib/commit/c340227da34141c978237e7659404df84e680d7a))
57
49
 
58
50
  ### 2.2.2 (2022-04-05)
59
51
 
60
52
  **Note:** Version bump only for package @scaleway/regex
61
53
 
62
-
63
-
64
-
65
-
66
54
  ### 2.2.1 (2022-03-11)
67
55
 
68
56
  **Note:** Version bump only for package @scaleway/regex
69
57
 
70
-
71
-
72
-
73
-
74
58
  ## 2.2.0 (2022-01-19)
75
59
 
76
-
77
60
  ### Features
78
61
 
79
- * add alphaLower and basicDomain regex ([#600](https://github.com/scaleway/scaleway-lib/issues/600)) ([418bda9](https://github.com/scaleway/scaleway-lib/commit/418bda9db7c3c342565e01433461d78079bb1b76))
80
-
81
-
62
+ - add alphaLower and basicDomain regex ([#600](https://github.com/scaleway/scaleway-lib/issues/600)) ([418bda9](https://github.com/scaleway/scaleway-lib/commit/418bda9db7c3c342565e01433461d78079bb1b76))
82
63
 
83
64
  ## 2.1.0 (2021-11-23)
84
65
 
85
-
86
66
  ### Features
87
67
 
88
- * add absolute path regex ([#514](https://github.com/scaleway/scaleway-lib/issues/514)) ([f271d72](https://github.com/scaleway/scaleway-lib/commit/f271d7251198f2119480a02dce844a283452e061))
89
-
90
-
68
+ - add absolute path regex ([#514](https://github.com/scaleway/scaleway-lib/issues/514)) ([f271d72](https://github.com/scaleway/scaleway-lib/commit/f271d7251198f2119480a02dce844a283452e061))
91
69
 
92
70
  ## 2.0.0 (2021-07-20)
93
71
 
94
-
95
72
  ### ⚠ BREAKING CHANGES
96
73
 
97
- * migrate the codebase to typescript
74
+ - migrate the codebase to typescript
98
75
 
99
76
  ### Code Refactoring
100
77
 
101
- * migrate to typescript ([#272](https://github.com/scaleway/scaleway-lib/issues/272)) ([3923c68](https://github.com/scaleway/scaleway-lib/commit/3923c68d6f7feadee7e2e30e32c9ef5d1f3003b9))
102
-
103
-
78
+ - migrate to typescript ([#272](https://github.com/scaleway/scaleway-lib/issues/272)) ([3923c68](https://github.com/scaleway/scaleway-lib/commit/3923c68d6f7feadee7e2e30e32c9ef5d1f3003b9))
104
79
 
105
80
  ### 1.4.3 (2021-05-11)
106
81
 
107
82
  **Note:** Version bump only for package @scaleway/regex
108
83
 
109
-
110
-
111
-
112
-
113
84
  ### 1.4.2 (2021-05-10)
114
85
 
115
86
  **Note:** Version bump only for package @scaleway/regex
116
87
 
117
-
118
-
119
-
120
-
121
88
  ### 1.4.1 (2021-04-15)
122
89
 
123
-
124
90
  ### Bug Fixes
125
91
 
126
- * add hexa regex ([#130](https://github.com/scaleway/scaleway-lib/issues/130)) ([a67e2e6](https://github.com/scaleway/scaleway-lib/commit/a67e2e65db928816bfa745bcf6f9631811e7640d))
127
-
128
-
92
+ - add hexa regex ([#130](https://github.com/scaleway/scaleway-lib/issues/130)) ([a67e2e6](https://github.com/scaleway/scaleway-lib/commit/a67e2e65db928816bfa745bcf6f9631811e7640d))
129
93
 
130
94
  # 1.4.0 (2021-03-12)
131
95
 
132
-
133
96
  ### Features
134
97
 
135
- * add mac address regex ([#67](https://github.com/scaleway/scaleway-lib/issues/67)) ([a4d8c83](https://github.com/scaleway/scaleway-lib/commit/a4d8c8300f1d8503ca0f8bbfbb8a4595fc24123c))
136
-
137
-
138
-
139
-
98
+ - add mac address regex ([#67](https://github.com/scaleway/scaleway-lib/issues/67)) ([a4d8c83](https://github.com/scaleway/scaleway-lib/commit/a4d8c8300f1d8503ca0f8bbfbb8a4595fc24123c))
140
99
 
141
100
  ## [1.3.1](https://github.com/scaleway/scaleway-lib/compare/@scaleway/regex@1.3.0...@scaleway/regex@1.3.1) (2021-02-15)
142
101
 
143
102
  **Note:** Version bump only for package @scaleway/regex
144
103
 
145
-
146
-
147
-
148
-
149
104
  # [1.3.0](https://github.com/scaleway/scaleway-lib/compare/@scaleway/regex@1.2.0...@scaleway/regex@1.3.0) (2021-02-15)
150
105
 
151
-
152
106
  ### Features
153
107
 
154
- * **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))
155
-
156
-
157
-
158
-
108
+ - **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))
159
109
 
160
110
  # 1.2.0 (2021-01-28)
161
111
 
162
-
163
112
  ### Features
164
113
 
165
- * **regex:** add deploy package ([b288c6f](https://github.com/scaleway/scaleway-lib/commit/b288c6f06bd6107064f5ea74acb2207954ec08e2))
166
-
167
-
168
-
169
-
114
+ - **regex:** add deploy package ([b288c6f](https://github.com/scaleway/scaleway-lib/commit/b288c6f06bd6107064f5ea74acb2207954ec08e2))
170
115
 
171
116
  # 1.1.0 (2020-11-09)
172
117
 
173
-
174
118
  ### Features
175
119
 
176
- * **regex:** add deploy package ([7fd5f83](https://github.com/scaleway/scaleway-lib/commit/7fd5f83f31737dc11946bb9bcbd16cf443c4af0d))
120
+ - **regex:** add deploy package ([7fd5f83](https://github.com/scaleway/scaleway-lib/commit/7fd5f83f31737dc11946bb9bcbd16cf443c4af0d))
@@ -14,11 +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
21
  const uppercaseBasicDomain = /^(?![-])+[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,63})+$/;
21
- const cron = /^[0-9,/*-]+$/;
22
+ const cron = /^((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})$/;
22
23
  const digits = /^[0-9]*$/;
23
24
  const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;
24
25
  const email = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
@@ -28,6 +29,8 @@ const spaces = /^\s*$/;
28
29
  const sixDigitsCode = /^[0-9]{6}$/;
29
30
  const url = /^http(s)?:\/\/?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/;
30
31
  const hexadecimal = /^[0-9a-fA-F]+$/;
32
+ const s3BucketName = /^[a-z0-9][-.a-z0-9]{1,61}[a-z0-9]$/;
33
+
31
34
  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}';
32
35
  const v6segment = '[a-fA-F\\d]{1,4}';
33
36
  const v6 = `
@@ -42,6 +45,7 @@ const v6 = `
42
45
  (?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:))
43
46
  )(?:%[0-9a-zA-Z]{1,})?
44
47
  `.replace(/\s*\/\/.*$/gm, '').replace(/\n/g, '').trim();
48
+
45
49
  const cidrv4 = `${v4}\\/(3[0-2]|[12]?[0-9])`;
46
50
  const cidrv6 = `${v6}\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])`;
47
51
  const ip = new RegExp(`^(?:${v4}|${v6})$`);
@@ -51,4 +55,4 @@ const ipCidr = new RegExp(`(?:^${cidrv4}$)|(?:^${cidrv6}$)`);
51
55
  const ipv4Cidr = new RegExp(`^${cidrv4}$`);
52
56
  const ipv6Cidr = new RegExp(`^${cidrv6}$`);
53
57
 
54
- 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 };
58
+ 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, s3BucketName, sixDigitsCode, spaces, uppercaseBasicDomain, url };
package/dist/index.d.ts CHANGED
@@ -28,6 +28,7 @@ declare const spaces: RegExp;
28
28
  declare const sixDigitsCode: RegExp;
29
29
  declare const url: RegExp;
30
30
  declare const hexadecimal: RegExp;
31
+ declare const s3BucketName: RegExp;
31
32
  declare const ip: RegExp;
32
33
  declare const ipv4: RegExp;
33
34
  declare const ipv6: RegExp;
@@ -35,4 +36,4 @@ declare const ipCidr: RegExp;
35
36
  declare const ipv4Cidr: RegExp;
36
37
  declare const ipv6Cidr: RegExp;
37
38
 
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 };
39
+ 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, s3BucketName, sixDigitsCode, spaces, uppercaseBasicDomain, url };
package/dist/index.js CHANGED
@@ -14,11 +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
21
  const uppercaseBasicDomain = /^(?![-])+[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,63})+$/;
21
- const cron = /^[0-9,/*-]+$/;
22
+ const cron = /^((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})$/;
22
23
  const digits = /^[0-9]*$/;
23
24
  const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;
24
25
  const email = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
@@ -28,6 +29,8 @@ const spaces = /^\s*$/;
28
29
  const sixDigitsCode = /^[0-9]{6}$/;
29
30
  const url = /^http(s)?:\/\/?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/;
30
31
  const hexadecimal = /^[0-9a-fA-F]+$/;
32
+ const s3BucketName = /^[a-z0-9][-.a-z0-9]{1,61}[a-z0-9]$/;
33
+
31
34
  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}';
32
35
  const v6segment = '[a-fA-F\\d]{1,4}';
33
36
  const v6 = `
@@ -42,6 +45,7 @@ const v6 = `
42
45
  (?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:))
43
46
  )(?:%[0-9a-zA-Z]{1,})?
44
47
  `.replace(/\s*\/\/.*$/gm, '').replace(/\n/g, '').trim();
48
+
45
49
  const cidrv4 = `${v4}\\/(3[0-2]|[12]?[0-9])`;
46
50
  const cidrv6 = `${v6}\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])`;
47
51
  const ip = new RegExp(`^(?:${v4}|${v6})$`);
@@ -51,4 +55,4 @@ const ipCidr = new RegExp(`(?:^${cidrv4}$)|(?:^${cidrv6}$)`);
51
55
  const ipv4Cidr = new RegExp(`^${cidrv4}$`);
52
56
  const ipv6Cidr = new RegExp(`^${cidrv6}$`);
53
57
 
54
- 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 };
58
+ 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, s3BucketName, sixDigitsCode, spaces, uppercaseBasicDomain, url };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/regex",
3
- "version": "2.5.2",
3
+ "version": "2.6.0",
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": "b89c00d2c64d95f1fe28e75987ceabfc38d7c0a9"
21
+ "gitHead": "910ea1cdcd307070927aa4ff875d9ad8a61e6abc"
22
22
  }