regex-belt 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Adriano Tirloni
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll as t };
package/dist/index.cjs ADDED
@@ -0,0 +1,72 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
3
+ var __defProp = Object.defineProperty;
4
+ var __exportAll = (all, no_symbols) => {
5
+ let target = {};
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
11
+ return target;
12
+ };
13
+ //#endregion
14
+ //#region src/regexen/countries/br.ts
15
+ var br_exports = /* @__PURE__ */ __exportAll({ cpf: () => cpf });
16
+ /**
17
+ * Matches a Brazilian CPF number in the format XXX.XXX.XXX-XX
18
+ *
19
+ * ___Enforces beginning and end of string___
20
+ * @example '123.456.789-09' (matches)
21
+ * @example '12345678909' (does not match)
22
+ */
23
+ const cpf = /^\d{3}\.\d{3}\.\d{3}-\d{2}$/;
24
+ //#endregion
25
+ //#region src/regexen/countries/index.ts
26
+ var countries_exports = /* @__PURE__ */ __exportAll({ br: () => br_exports });
27
+ //#endregion
28
+ //#region src/regexen/datetime.ts
29
+ var datetime_exports = /* @__PURE__ */ __exportAll({
30
+ UTC_ISOString: () => UTC_ISOString,
31
+ dashed_YYYYMMDD: () => dashed_YYYYMMDD,
32
+ dashed_YYYYMMDD_Loose: () => dashed_YYYYMMDD_Loose
33
+ });
34
+ /**
35
+ * Regex that matches a UTC ISO String Date in format YYYY-MM-DDTHH:mm:ss.sssZ
36
+ * @example 2022-12-31T23:59:59.999Z (with milliseconds)
37
+ * @example 2022-12-31T23:59:59Z (without milliseconds)
38
+ */
39
+ const UTC_ISOString = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/;
40
+ /**
41
+ * Matches a date in the format YYYY-MM-DD
42
+ * Valid digits are 0000 to 9999 for year, 01 to 12 for month and 01 to 31 for day.
43
+ *
44
+ * ___Enforces beginning and end of string___
45
+ * @example '2022-12-31' (matches)
46
+ * @example '2022-12-31T23:59:59.999Z' (does not match)
47
+ * @example '9992022-12-31' (does not match)
48
+ */
49
+ const dashed_YYYYMMDD = /^([0-9]{4}-([0][1-9]|[1][0-2])-([1-2][0-9]|[0][1-9]|[3][0-1]))$/;
50
+ /**
51
+ * Matches a date in the format YYYY-MM-DD
52
+ * Valid digits are 0000 to 9999 for year, 01 to 12 for month and 01 to 31 for day
53
+ *
54
+ * ___Does not enforce beginning and end of string___
55
+ * @example '2022-12-31' (matches)
56
+ * @example '2022-12-31T23:59:59.999Z' (matches)
57
+ * @example '9992022-12-31' (matches)
58
+ */
59
+ const dashed_YYYYMMDD_Loose = /([0-9]{4}-([0][1-9]|[1][0-2])-([1-2][0-9]|[0][1-9]|[3][0-1]))/;
60
+ //#endregion
61
+ Object.defineProperty(exports, "countries", {
62
+ enumerable: true,
63
+ get: function() {
64
+ return countries_exports;
65
+ }
66
+ });
67
+ Object.defineProperty(exports, "datetime", {
68
+ enumerable: true,
69
+ get: function() {
70
+ return datetime_exports;
71
+ }
72
+ });
@@ -0,0 +1,46 @@
1
+ declare namespace br_d_exports {
2
+ export { cpf };
3
+ }
4
+ /**
5
+ * Matches a Brazilian CPF number in the format XXX.XXX.XXX-XX
6
+ *
7
+ * ___Enforces beginning and end of string___
8
+ * @example '123.456.789-09' (matches)
9
+ * @example '12345678909' (does not match)
10
+ */
11
+ declare const cpf: RegExp;
12
+ declare namespace index_d_exports {
13
+ export { br_d_exports as br };
14
+ }
15
+ declare namespace datetime_d_exports {
16
+ export { UTC_ISOString, dashed_YYYYMMDD, dashed_YYYYMMDD_Loose };
17
+ }
18
+ /**
19
+ * Regex that matches a UTC ISO String Date in format YYYY-MM-DDTHH:mm:ss.sssZ
20
+ * @example 2022-12-31T23:59:59.999Z (with milliseconds)
21
+ * @example 2022-12-31T23:59:59Z (without milliseconds)
22
+ */
23
+ declare const UTC_ISOString: RegExp;
24
+ /**
25
+ * Matches a date in the format YYYY-MM-DD
26
+ * Valid digits are 0000 to 9999 for year, 01 to 12 for month and 01 to 31 for day.
27
+ *
28
+ * ___Enforces beginning and end of string___
29
+ * @example '2022-12-31' (matches)
30
+ * @example '2022-12-31T23:59:59.999Z' (does not match)
31
+ * @example '9992022-12-31' (does not match)
32
+ */
33
+ declare const dashed_YYYYMMDD: RegExp;
34
+ /**
35
+ * Matches a date in the format YYYY-MM-DD
36
+ * Valid digits are 0000 to 9999 for year, 01 to 12 for month and 01 to 31 for day
37
+ *
38
+ * ___Does not enforce beginning and end of string___
39
+ * @example '2022-12-31' (matches)
40
+ * @example '2022-12-31T23:59:59.999Z' (matches)
41
+ * @example '9992022-12-31' (matches)
42
+ */
43
+ declare const dashed_YYYYMMDD_Loose: RegExp;
44
+ //#endregion
45
+ export { index_d_exports as countries, datetime_d_exports as datetime };
46
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/regexen/countries/br.ts","../src/regexen/countries/index.ts","../src/regexen/datetime.ts"],"mappings":";;;;;;;;;;cAOa,GAAA,EAAG,MAAA;AAAA;;;;;;;;;;;cEFH,aAAA,EAAa,MAAA;;;;;;;;;;cAWb,eAAA,EAAe,MAAA;;;;AFT5B;;;;;;cEoBa,qBAAA,EAAqB,MAAA"}
@@ -0,0 +1,46 @@
1
+ declare namespace br_d_exports {
2
+ export { cpf };
3
+ }
4
+ /**
5
+ * Matches a Brazilian CPF number in the format XXX.XXX.XXX-XX
6
+ *
7
+ * ___Enforces beginning and end of string___
8
+ * @example '123.456.789-09' (matches)
9
+ * @example '12345678909' (does not match)
10
+ */
11
+ declare const cpf: RegExp;
12
+ declare namespace index_d_exports {
13
+ export { br_d_exports as br };
14
+ }
15
+ declare namespace datetime_d_exports {
16
+ export { UTC_ISOString, dashed_YYYYMMDD, dashed_YYYYMMDD_Loose };
17
+ }
18
+ /**
19
+ * Regex that matches a UTC ISO String Date in format YYYY-MM-DDTHH:mm:ss.sssZ
20
+ * @example 2022-12-31T23:59:59.999Z (with milliseconds)
21
+ * @example 2022-12-31T23:59:59Z (without milliseconds)
22
+ */
23
+ declare const UTC_ISOString: RegExp;
24
+ /**
25
+ * Matches a date in the format YYYY-MM-DD
26
+ * Valid digits are 0000 to 9999 for year, 01 to 12 for month and 01 to 31 for day.
27
+ *
28
+ * ___Enforces beginning and end of string___
29
+ * @example '2022-12-31' (matches)
30
+ * @example '2022-12-31T23:59:59.999Z' (does not match)
31
+ * @example '9992022-12-31' (does not match)
32
+ */
33
+ declare const dashed_YYYYMMDD: RegExp;
34
+ /**
35
+ * Matches a date in the format YYYY-MM-DD
36
+ * Valid digits are 0000 to 9999 for year, 01 to 12 for month and 01 to 31 for day
37
+ *
38
+ * ___Does not enforce beginning and end of string___
39
+ * @example '2022-12-31' (matches)
40
+ * @example '2022-12-31T23:59:59.999Z' (matches)
41
+ * @example '9992022-12-31' (matches)
42
+ */
43
+ declare const dashed_YYYYMMDD_Loose: RegExp;
44
+ //#endregion
45
+ export { index_d_exports as countries, datetime_d_exports as datetime };
46
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/regexen/countries/br.ts","../src/regexen/countries/index.ts","../src/regexen/datetime.ts"],"mappings":";;;;;;;AAOA;;;cAAa,GAAA,EAAG,MAAA;AAAA;;;;;;;;;;AAAhB;cEFa,aAAA,EAAa,MAAA;;;;;;;;;;cAWb,eAAA,EAAe,MAAA;;;;;;AAX5B;;;;cAsBa,qBAAA,EAAqB,MAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,51 @@
1
+ import { t as __exportAll } from "./chunk-CfYAbeIz.mjs";
2
+ //#region src/regexen/countries/br.ts
3
+ var br_exports = /* @__PURE__ */ __exportAll({ cpf: () => cpf });
4
+ /**
5
+ * Matches a Brazilian CPF number in the format XXX.XXX.XXX-XX
6
+ *
7
+ * ___Enforces beginning and end of string___
8
+ * @example '123.456.789-09' (matches)
9
+ * @example '12345678909' (does not match)
10
+ */
11
+ const cpf = /^\d{3}\.\d{3}\.\d{3}-\d{2}$/;
12
+ //#endregion
13
+ //#region src/regexen/countries/index.ts
14
+ var countries_exports = /* @__PURE__ */ __exportAll({ br: () => br_exports });
15
+ //#endregion
16
+ //#region src/regexen/datetime.ts
17
+ var datetime_exports = /* @__PURE__ */ __exportAll({
18
+ UTC_ISOString: () => UTC_ISOString,
19
+ dashed_YYYYMMDD: () => dashed_YYYYMMDD,
20
+ dashed_YYYYMMDD_Loose: () => dashed_YYYYMMDD_Loose
21
+ });
22
+ /**
23
+ * Regex that matches a UTC ISO String Date in format YYYY-MM-DDTHH:mm:ss.sssZ
24
+ * @example 2022-12-31T23:59:59.999Z (with milliseconds)
25
+ * @example 2022-12-31T23:59:59Z (without milliseconds)
26
+ */
27
+ const UTC_ISOString = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/;
28
+ /**
29
+ * Matches a date in the format YYYY-MM-DD
30
+ * Valid digits are 0000 to 9999 for year, 01 to 12 for month and 01 to 31 for day.
31
+ *
32
+ * ___Enforces beginning and end of string___
33
+ * @example '2022-12-31' (matches)
34
+ * @example '2022-12-31T23:59:59.999Z' (does not match)
35
+ * @example '9992022-12-31' (does not match)
36
+ */
37
+ const dashed_YYYYMMDD = /^([0-9]{4}-([0][1-9]|[1][0-2])-([1-2][0-9]|[0][1-9]|[3][0-1]))$/;
38
+ /**
39
+ * Matches a date in the format YYYY-MM-DD
40
+ * Valid digits are 0000 to 9999 for year, 01 to 12 for month and 01 to 31 for day
41
+ *
42
+ * ___Does not enforce beginning and end of string___
43
+ * @example '2022-12-31' (matches)
44
+ * @example '2022-12-31T23:59:59.999Z' (matches)
45
+ * @example '9992022-12-31' (matches)
46
+ */
47
+ const dashed_YYYYMMDD_Loose = /([0-9]{4}-([0][1-9]|[1][0-2])-([1-2][0-9]|[0][1-9]|[3][0-1]))/;
48
+ //#endregion
49
+ export { countries_exports as countries, datetime_exports as datetime };
50
+
51
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/regexen/countries/br.ts","../src/regexen/countries/index.ts","../src/regexen/datetime.ts"],"sourcesContent":["/**\n * Matches a Brazilian CPF number in the format XXX.XXX.XXX-XX\n *\n * ___Enforces beginning and end of string___\n * @example '123.456.789-09' (matches)\n * @example '12345678909' (does not match)\n */\nexport const cpf = /^\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}$/;\n","export * as br from './br.ts';\n","/**\n * Regex that matches a UTC ISO String Date in format YYYY-MM-DDTHH:mm:ss.sssZ\n * @example 2022-12-31T23:59:59.999Z (with milliseconds)\n * @example 2022-12-31T23:59:59Z (without milliseconds)\n */\nexport const UTC_ISOString = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$/;\n\n/**\n * Matches a date in the format YYYY-MM-DD\n * Valid digits are 0000 to 9999 for year, 01 to 12 for month and 01 to 31 for day.\n *\n * ___Enforces beginning and end of string___\n * @example '2022-12-31' (matches)\n * @example '2022-12-31T23:59:59.999Z' (does not match)\n * @example '9992022-12-31' (does not match)\n */\nexport const dashed_YYYYMMDD = /^([0-9]{4}-([0][1-9]|[1][0-2])-([1-2][0-9]|[0][1-9]|[3][0-1]))$/;\n\n/**\n * Matches a date in the format YYYY-MM-DD\n * Valid digits are 0000 to 9999 for year, 01 to 12 for month and 01 to 31 for day\n *\n * ___Does not enforce beginning and end of string___\n * @example '2022-12-31' (matches)\n * @example '2022-12-31T23:59:59.999Z' (matches)\n * @example '9992022-12-31' (matches)\n */\nexport const dashed_YYYYMMDD_Loose =\n /([0-9]{4}-([0][1-9]|[1][0-2])-([1-2][0-9]|[0][1-9]|[3][0-1]))/;\n"],"mappings":";;;;;;;;;;AAOA,MAAa,MAAM;;;;;;;;;;;;;;;;AEFnB,MAAa,gBAAgB;;;;;;;;;;AAW7B,MAAa,kBAAkB;;;;;;;;;;AAW/B,MAAa,wBACX"}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "regex-belt",
3
+ "description": "A collection of commonly used regular expressions, organized by category.",
4
+ "repository": {
5
+ "url": "git+https://github.com/adriano-tirloni/regexbelt.git"
6
+ },
7
+ "keywords": [
8
+ "regex",
9
+ "regexp",
10
+ "patterns",
11
+ "validation"
12
+ ],
13
+ "version": "0.1.0",
14
+ "sideEffects": false,
15
+ "type": "module",
16
+ "author": "Adriano Tirloni",
17
+ "license": "MIT",
18
+ "main": "./dist/index.cjs",
19
+ "module": "./dist/index.mjs",
20
+ "types": "./dist/index.d.mts",
21
+ "exports": {
22
+ ".": {
23
+ "types": {
24
+ "import": "./dist/index.d.mts",
25
+ "require": "./dist/index.d.cts"
26
+ },
27
+ "import": "./dist/index.mjs",
28
+ "require": "./dist/index.cjs"
29
+ }
30
+ },
31
+ "files": [
32
+ "dist"
33
+ ],
34
+ "devDependencies": {
35
+ "@biomejs/biome": "^2.4.8",
36
+ "tsdown": "^0.21.4",
37
+ "typescript": "^5.9.3",
38
+ "vitest": "^4.1.0"
39
+ },
40
+ "scripts": {
41
+ "lint": "biome check .",
42
+ "type-check": "tsc --noEmit",
43
+ "test": "vitest run",
44
+ "build": "tsdown"
45
+ }
46
+ }