@scaleway/regex 2.2.2 → 2.2.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,6 +3,15 @@
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.2.3 (2022-04-26)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **regex:** improve url regex ([#736](https://github.com/scaleway/scaleway-lib/issues/736)) ([c340227](https://github.com/scaleway/scaleway-lib/commit/c340227da34141c978237e7659404df84e680d7a))
12
+
13
+
14
+
6
15
  ### 2.2.2 (2022-04-05)
7
16
 
8
17
  **Note:** Version bump only for package @scaleway/regex
@@ -12,21 +12,19 @@ const alphanumLowercase = /^[a-z0-9]+$/;
12
12
  const alphanumSpacesDotsUnderscoreDash = /^[a-zA-Z0-9-.\s_]*$/;
13
13
  const alphanumUnderscoreDash = /^[a-zA-Z0-9_-]*$/;
14
14
  const alphanumUnderscoreDollarDash = /^[a-zA-Z0-9_$-]*$/;
15
- const absoluteLinuxPath = /(^\/$|^(\/[a-zA-Z0-9_]+)*$)/; // eslint-disable-next-line no-control-regex
16
-
15
+ const absoluteLinuxPath = /(^\/$|^(\/[a-zA-Z0-9_]+)*$)/;
17
16
  const ascii = /^[\x00-\x7F]+$/;
18
17
  const backupKey = /^[A-Z0-9]{32}$/;
19
18
  const basicDomain = /^[a-z0-9-]+(\.[a-z0-9-]{1,63})+$/;
20
19
  const cron = /^[0-9,/*-]+$/;
21
20
  const digits = /^[0-9]*$/;
22
- const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/; // Used by W3C
23
-
21
+ const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;
24
22
  const email = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
25
23
  const fourDigitsCode = /^[0-9]{4}$/;
26
24
  const phone = /^\+[0-9]*/;
27
25
  const spaces = /^\s*$/;
28
26
  const sixDigitsCode = /^[0-9]{6}$/;
29
- const url = /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/;
27
+ const url = /^http(s)?:\/\/?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/;
30
28
  const hexadecimal = /^[0-9a-fA-F]+$/;
31
29
 
32
30
  export { absoluteLinuxPath, alpha, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdots, ascii, backupKey, basicDomain, cron, digits, email, fourDigitsCode, hexadecimal, macAddress, phone, sixDigitsCode, spaces, url };
package/dist/index.js CHANGED
@@ -12,21 +12,19 @@ const alphanumLowercase = /^[a-z0-9]+$/;
12
12
  const alphanumSpacesDotsUnderscoreDash = /^[a-zA-Z0-9-.\s_]*$/;
13
13
  const alphanumUnderscoreDash = /^[a-zA-Z0-9_-]*$/;
14
14
  const alphanumUnderscoreDollarDash = /^[a-zA-Z0-9_$-]*$/;
15
- const absoluteLinuxPath = /(^\/$|^(\/[a-zA-Z0-9_]+)*$)/; // eslint-disable-next-line no-control-regex
16
-
15
+ const absoluteLinuxPath = /(^\/$|^(\/[a-zA-Z0-9_]+)*$)/;
17
16
  const ascii = /^[\x00-\x7F]+$/;
18
17
  const backupKey = /^[A-Z0-9]{32}$/;
19
18
  const basicDomain = /^[a-z0-9-]+(\.[a-z0-9-]{1,63})+$/;
20
19
  const cron = /^[0-9,/*-]+$/;
21
20
  const digits = /^[0-9]*$/;
22
- const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/; // Used by W3C
23
-
21
+ const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;
24
22
  const email = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
25
23
  const fourDigitsCode = /^[0-9]{4}$/;
26
24
  const phone = /^\+[0-9]*/;
27
25
  const spaces = /^\s*$/;
28
26
  const sixDigitsCode = /^[0-9]{6}$/;
29
- const url = /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/;
27
+ const url = /^http(s)?:\/\/?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/;
30
28
  const hexadecimal = /^[0-9a-fA-F]+$/;
31
29
 
32
30
  export { absoluteLinuxPath, alpha, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdots, ascii, backupKey, basicDomain, cron, digits, email, fourDigitsCode, hexadecimal, macAddress, phone, sixDigitsCode, spaces, url };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/regex",
3
- "version": "2.2.2",
3
+ "version": "2.2.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": "f5789858da50231e50baa15f68e757696c838a65"
21
+ "gitHead": "ff7f6755c6eac35e88d2c8f177fc74c678095800"
22
22
  }