@regexto/validators 1.0.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.
Files changed (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +142 -0
  3. package/dist/chunk-DL6DNLHZ.mjs +117 -0
  4. package/dist/index.d.mts +107 -0
  5. package/dist/index.d.ts +107 -0
  6. package/dist/index.js +154 -0
  7. package/dist/index.mjs +28 -0
  8. package/dist/zod.d.mts +29 -0
  9. package/dist/zod.d.ts +29 -0
  10. package/dist/zod.js +81 -0
  11. package/dist/zod.mjs +27 -0
  12. package/package.json +62 -0
  13. package/patterns/au-abn.json +15 -0
  14. package/patterns/base64.json +14 -0
  15. package/patterns/bech32-address.json +14 -0
  16. package/patterns/bitcoin-address.json +14 -0
  17. package/patterns/br-cnpj.json +15 -0
  18. package/patterns/br-cpf.json +15 -0
  19. package/patterns/cn-resident-id.json +15 -0
  20. package/patterns/coordinates.json +14 -0
  21. package/patterns/credit-card.json +14 -0
  22. package/patterns/crypto-mnemonic-word.json +17 -0
  23. package/patterns/date-eu.json +14 -0
  24. package/patterns/date-us.json +14 -0
  25. package/patterns/datetime-iso.json +14 -0
  26. package/patterns/de-plz.json +15 -0
  27. package/patterns/de-steuerid.json +15 -0
  28. package/patterns/domain.json +14 -0
  29. package/patterns/email.json +14 -0
  30. package/patterns/ens-name.json +14 -0
  31. package/patterns/es-nif.json +15 -0
  32. package/patterns/ethereum-address.json +14 -0
  33. package/patterns/fr-postal.json +15 -0
  34. package/patterns/fr-siren.json +15 -0
  35. package/patterns/fr-siret.json +15 -0
  36. package/patterns/git-sha.json +14 -0
  37. package/patterns/hashtag.json +14 -0
  38. package/patterns/hex-color.json +14 -0
  39. package/patterns/hsl-color.json +14 -0
  40. package/patterns/html-tag.json +14 -0
  41. package/patterns/iban.json +14 -0
  42. package/patterns/in-pan.json +15 -0
  43. package/patterns/ipfs-cid.json +17 -0
  44. package/patterns/ipv4.json +14 -0
  45. package/patterns/ipv6.json +14 -0
  46. package/patterns/iso-date.json +14 -0
  47. package/patterns/it-codice-fiscale.json +15 -0
  48. package/patterns/jwt.json +14 -0
  49. package/patterns/latitude.json +14 -0
  50. package/patterns/lightning-invoice.json +17 -0
  51. package/patterns/longitude.json +14 -0
  52. package/patterns/mac-address.json +14 -0
  53. package/patterns/markdown-blockquote.json +14 -0
  54. package/patterns/markdown-bold.json +14 -0
  55. package/patterns/markdown-code-inline.json +14 -0
  56. package/patterns/markdown-heading.json +14 -0
  57. package/patterns/markdown-hr.json +14 -0
  58. package/patterns/markdown-image.json +14 -0
  59. package/patterns/markdown-italic.json +14 -0
  60. package/patterns/markdown-link.json +14 -0
  61. package/patterns/markdown-list-item.json +14 -0
  62. package/patterns/markdown-table-row.json +14 -0
  63. package/patterns/md5.json +14 -0
  64. package/patterns/mention.json +14 -0
  65. package/patterns/monero-address.json +14 -0
  66. package/patterns/password-strong.json +14 -0
  67. package/patterns/phone-e164.json +14 -0
  68. package/patterns/phone-uk.json +15 -0
  69. package/patterns/phone-us.json +15 -0
  70. package/patterns/pl-nip.json +15 -0
  71. package/patterns/pl-pesel.json +15 -0
  72. package/patterns/pl-regon.json +15 -0
  73. package/patterns/port-number.json +14 -0
  74. package/patterns/rgb-color.json +14 -0
  75. package/patterns/ru-inn.json +15 -0
  76. package/patterns/semver.json +14 -0
  77. package/patterns/sha256.json +17 -0
  78. package/patterns/slug.json +14 -0
  79. package/patterns/solana-address.json +14 -0
  80. package/patterns/swift-bic.json +14 -0
  81. package/patterns/time-24h.json +14 -0
  82. package/patterns/txhash-eth.json +17 -0
  83. package/patterns/uk-nino.json +15 -0
  84. package/patterns/uk-postcode.json +15 -0
  85. package/patterns/url.json +14 -0
  86. package/patterns/us-ein.json +15 -0
  87. package/patterns/us-ssn.json +15 -0
  88. package/patterns/us-zip.json +15 -0
  89. package/patterns/username.json +14 -0
  90. package/patterns/uuid.json +14 -0
  91. package/patterns/youtube-url.json +14 -0
package/dist/zod.d.mts ADDED
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { RegexPattern } from './index.mjs';
3
+
4
+ type ZodStringSchema = z.ZodString;
5
+ /**
6
+ * Returns a Zod string schema with the regex validator applied.
7
+ *
8
+ * @example
9
+ * import { zodSchema } from '@regex.to/validators/zod';
10
+ * const emailSchema = zodSchema('email');
11
+ * emailSchema.parse('user@example.com'); // ✓
12
+ */
13
+ declare function zodSchema(slug: string, message?: string): ZodStringSchema;
14
+ /**
15
+ * Returns a full Zod object schema from a map of field → pattern slug.
16
+ *
17
+ * @example
18
+ * const schema = zodObjectSchema({ email: 'email', website: 'url' });
19
+ */
20
+ declare function zodObjectSchema(fieldMap: Record<string, string>, messages?: Record<string, string>): z.ZodObject<Record<string, ZodStringSchema>>;
21
+ /**
22
+ * Returns the pattern definition along with its Zod schema.
23
+ */
24
+ declare function getPatternWithSchema(slug: string): {
25
+ pattern: RegexPattern;
26
+ schema: ZodStringSchema;
27
+ };
28
+
29
+ export { getPatternWithSchema, zodObjectSchema, zodSchema };
package/dist/zod.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { RegexPattern } from './index.js';
3
+
4
+ type ZodStringSchema = z.ZodString;
5
+ /**
6
+ * Returns a Zod string schema with the regex validator applied.
7
+ *
8
+ * @example
9
+ * import { zodSchema } from '@regex.to/validators/zod';
10
+ * const emailSchema = zodSchema('email');
11
+ * emailSchema.parse('user@example.com'); // ✓
12
+ */
13
+ declare function zodSchema(slug: string, message?: string): ZodStringSchema;
14
+ /**
15
+ * Returns a full Zod object schema from a map of field → pattern slug.
16
+ *
17
+ * @example
18
+ * const schema = zodObjectSchema({ email: 'email', website: 'url' });
19
+ */
20
+ declare function zodObjectSchema(fieldMap: Record<string, string>, messages?: Record<string, string>): z.ZodObject<Record<string, ZodStringSchema>>;
21
+ /**
22
+ * Returns the pattern definition along with its Zod schema.
23
+ */
24
+ declare function getPatternWithSchema(slug: string): {
25
+ pattern: RegexPattern;
26
+ schema: ZodStringSchema;
27
+ };
28
+
29
+ export { getPatternWithSchema, zodObjectSchema, zodSchema };
package/dist/zod.js ADDED
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/zod.ts
31
+ var zod_exports = {};
32
+ __export(zod_exports, {
33
+ getPatternWithSchema: () => getPatternWithSchema,
34
+ zodObjectSchema: () => zodObjectSchema,
35
+ zodSchema: () => zodSchema
36
+ });
37
+ module.exports = __toCommonJS(zod_exports);
38
+ var import_zod = require("zod");
39
+
40
+ // src/index.ts
41
+ var import_fs = __toESM(require("fs"));
42
+ var import_path = __toESM(require("path"));
43
+ function loadPatterns() {
44
+ const dir = import_path.default.join(__dirname, "..", "patterns");
45
+ const result = {};
46
+ try {
47
+ const files = import_fs.default.readdirSync(dir).filter((f) => f.endsWith(".json"));
48
+ for (const file of files) {
49
+ const raw = import_fs.default.readFileSync(import_path.default.join(dir, file), "utf-8");
50
+ const p = JSON.parse(raw);
51
+ result[p.slug] = p;
52
+ }
53
+ } catch {
54
+ }
55
+ return result;
56
+ }
57
+ var PATTERNS = loadPatterns();
58
+
59
+ // src/zod.ts
60
+ function zodSchema(slug, message) {
61
+ const p = PATTERNS[slug];
62
+ if (!p) throw new Error(`Pattern "${slug}" not found in @regex.to/validators`);
63
+ const regex = new RegExp(`^(?:${p.pattern})$`, p.flags);
64
+ return import_zod.z.string().regex(regex, message ?? `Invalid ${p.name}`);
65
+ }
66
+ function zodObjectSchema(fieldMap, messages) {
67
+ const shape = {};
68
+ for (const [field, slug] of Object.entries(fieldMap)) {
69
+ shape[field] = zodSchema(slug, messages?.[field]);
70
+ }
71
+ return import_zod.z.object(shape);
72
+ }
73
+ function getPatternWithSchema(slug) {
74
+ return { pattern: PATTERNS[slug], schema: zodSchema(slug) };
75
+ }
76
+ // Annotate the CommonJS export names for ESM import in node:
77
+ 0 && (module.exports = {
78
+ getPatternWithSchema,
79
+ zodObjectSchema,
80
+ zodSchema
81
+ });
package/dist/zod.mjs ADDED
@@ -0,0 +1,27 @@
1
+ import {
2
+ PATTERNS
3
+ } from "./chunk-DL6DNLHZ.mjs";
4
+
5
+ // src/zod.ts
6
+ import { z } from "zod";
7
+ function zodSchema(slug, message) {
8
+ const p = PATTERNS[slug];
9
+ if (!p) throw new Error(`Pattern "${slug}" not found in @regex.to/validators`);
10
+ const regex = new RegExp(`^(?:${p.pattern})$`, p.flags);
11
+ return z.string().regex(regex, message ?? `Invalid ${p.name}`);
12
+ }
13
+ function zodObjectSchema(fieldMap, messages) {
14
+ const shape = {};
15
+ for (const [field, slug] of Object.entries(fieldMap)) {
16
+ shape[field] = zodSchema(slug, messages?.[field]);
17
+ }
18
+ return z.object(shape);
19
+ }
20
+ function getPatternWithSchema(slug) {
21
+ return { pattern: PATTERNS[slug], schema: zodSchema(slug) };
22
+ }
23
+ export {
24
+ getPatternWithSchema,
25
+ zodObjectSchema,
26
+ zodSchema
27
+ };
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@regexto/validators",
3
+ "version": "1.0.0",
4
+ "description": "A curated collection of battle-tested regex patterns with TypeScript types, Zod integration, and multi-language code generation.",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ },
14
+ "./zod": {
15
+ "types": "./dist/zod.d.ts",
16
+ "import": "./dist/zod.mjs",
17
+ "require": "./dist/zod.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "patterns"
23
+ ],
24
+ "scripts": {
25
+ "build": "tsup src/index.ts src/zod.ts --format cjs,esm --dts --clean --shims",
26
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch --shims",
27
+ "test": "vitest run",
28
+ "test:watch": "vitest",
29
+ "lint": "eslint src --ext .ts",
30
+ "prepublishOnly": "npm run build && npm test"
31
+ },
32
+ "keywords": [
33
+ "regex",
34
+ "validation",
35
+ "typescript",
36
+ "zod",
37
+ "validators",
38
+ "patterns"
39
+ ],
40
+ "author": "regex.to",
41
+ "license": "MIT",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "https://github.com/regex-to/validators"
45
+ },
46
+ "homepage": "https://regex.to",
47
+ "peerDependencies": {
48
+ "zod": ">=4.0.0"
49
+ },
50
+ "peerDependenciesMeta": {
51
+ "zod": {
52
+ "optional": true
53
+ }
54
+ },
55
+ "devDependencies": {
56
+ "@types/node": "^26.1.0",
57
+ "tsup": "^8.5.1",
58
+ "typescript": "^6.0.3",
59
+ "vitest": "^4.1.10",
60
+ "zod": "^4.4.3"
61
+ }
62
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "slug": "au-abn",
3
+ "name": "Australian ABN",
4
+ "description": "Matches an Australian Business Number (ABN) — 11 digits, optionally space-separated in groups.",
5
+ "category": "Identity",
6
+ "pattern": "\\d{2}\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}",
7
+ "flags": "",
8
+ "examples": ["51 824 753 556", "51824753556", "12 345 678 901"],
9
+ "counterExamples": ["51 824 753", "518247535561", "AB 824 753 556"],
10
+ "locales": ["en-AU"],
11
+ "tags": ["abn", "australia", "australian", "business", "tax"],
12
+ "useCases": ["Australian business forms", "GST invoicing", "Tax reporting"],
13
+ "seoTitle": "Australian ABN Regex — Validate Business Numbers",
14
+ "seoDescription": "Regex for Australian Business Number (ABN) validation."
15
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "slug": "base64",
3
+ "name": "Base64 Encoded String",
4
+ "description": "Matches a valid Base64-encoded string with proper padding using = characters.",
5
+ "category": "Security",
6
+ "pattern": "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$",
7
+ "flags": "",
8
+ "examples": ["SGVsbG8gV29ybGQ=", "dGVzdA==", "YWJjZGVmZ2g="],
9
+ "counterExamples": ["SGVsbG8gV29ybGQ", "not!base64@string", "YWJjZGVmZ2g==="],
10
+ "tags": ["base64", "encoding", "data"],
11
+ "useCases": ["File upload validation", "API token parsing", "Image data URIs"],
12
+ "seoTitle": "Base64 Regex — Validate Base64 Encoding in JS, Go, PHP",
13
+ "seoDescription": "Regex for Base64 string validation with proper padding."
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "slug": "bech32-address",
3
+ "name": "Bitcoin Bech32 Address (SegWit)",
4
+ "description": "Matches a Bitcoin native SegWit address in Bech32 format — starts with bc1 followed by 6–87 lowercase alphanumeric characters.",
5
+ "category": "Crypto",
6
+ "pattern": "bc1[ac-hj-np-z02-9]{6,87}",
7
+ "flags": "i",
8
+ "examples": ["bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq", "bc1p5d7rjq7g6rdk2yhzks9smlaqtedr4dekq08ge52"],
9
+ "counterExamples": ["1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2", "0xde0B295669a9FD93d5F28D9Ec85E40f4", "bc1short"],
10
+ "tags": ["bitcoin", "btc", "bech32", "segwit", "p2wpkh", "crypto"],
11
+ "useCases": ["Bitcoin wallet validation", "Payment processors", "Crypto exchanges"],
12
+ "seoTitle": "Bech32 Bitcoin Address Regex — Validate SegWit Addresses",
13
+ "seoDescription": "Regex for Bitcoin Bech32 (bc1) native SegWit address validation."
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "slug": "bitcoin-address",
3
+ "name": "Bitcoin Address (Legacy)",
4
+ "description": "Matches a legacy Bitcoin address — P2PKH (starting with 1) or P2SH (starting with 3), 25–34 Base58 characters.",
5
+ "category": "Crypto",
6
+ "pattern": "[13][a-km-zA-HJ-NP-Z1-9]{25,34}",
7
+ "flags": "",
8
+ "examples": ["1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2", "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy"],
9
+ "counterExamples": ["0BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2", "1BvBMSEYstWetq", "1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2_extra"],
10
+ "tags": ["bitcoin", "btc", "crypto", "address", "blockchain"],
11
+ "useCases": ["Crypto payment validation", "Wallet address input", "Transaction verification"],
12
+ "seoTitle": "Bitcoin Address Regex — Validate BTC Addresses",
13
+ "seoDescription": "Regex for Bitcoin legacy address validation (P2PKH and P2SH)."
14
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "slug": "br-cnpj",
3
+ "name": "Brazilian CNPJ",
4
+ "description": "Matches a Brazilian CNPJ (Cadastro Nacional da Pessoa Jurídica) — company identifier in formatted or unformatted form.",
5
+ "category": "Identity",
6
+ "pattern": "\\d{2}\\.?\\d{3}\\.?\\d{3}\\/?\\d{4}-?\\d{2}",
7
+ "flags": "",
8
+ "examples": ["11.222.333/0001-81", "11222333000181"],
9
+ "counterExamples": ["11.222.333/0001", "11.222.333/0001-8", "AB.222.333/0001-81"],
10
+ "locales": ["pt-BR"],
11
+ "tags": ["cnpj", "brazil", "company", "business", "tax"],
12
+ "useCases": ["Brazilian B2B forms", "Invoice validation", "Company registration"],
13
+ "seoTitle": "Brazilian CNPJ Regex — Validate CNPJ Numbers",
14
+ "seoDescription": "Regex for Brazilian CNPJ company identifier validation."
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "slug": "br-cpf",
3
+ "name": "Brazilian CPF",
4
+ "description": "Matches a Brazilian CPF (Cadastro de Pessoas Físicas) number in formatted (NNN.NNN.NNN-NN) or unformatted (NNNNNNNNNNN) form.",
5
+ "category": "Identity",
6
+ "pattern": "\\d{3}\\.?\\d{3}\\.?\\d{3}-?\\d{2}",
7
+ "flags": "",
8
+ "examples": ["123.456.789-09", "12345678909", "111.444.777-35"],
9
+ "counterExamples": ["123.456.789", "1234567890", "abc.456.789-09"],
10
+ "locales": ["pt-BR"],
11
+ "tags": ["cpf", "brazil", "brazilian", "identity", "tax"],
12
+ "useCases": ["Brazilian government forms", "E-commerce checkout", "KYC verification"],
13
+ "seoTitle": "Brazilian CPF Regex — Validate CPF Numbers",
14
+ "seoDescription": "Regex for Brazilian CPF number validation. Supports formatted and unformatted input."
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "slug": "cn-resident-id",
3
+ "name": "Chinese Resident ID",
4
+ "description": "Matches a Chinese national resident identity card number — 17 digits followed by one digit or X (checksum digit).",
5
+ "category": "Identity",
6
+ "pattern": "\\d{17}[\\dXx]",
7
+ "flags": "",
8
+ "examples": ["11010519491231002X", "440301198001012158"],
9
+ "counterExamples": ["11010519491231002", "1101051949123100200", "1101051949123100Y"],
10
+ "locales": ["zh-CN"],
11
+ "tags": ["china", "chinese", "resident-id", "identity", "idcard"],
12
+ "useCases": ["Chinese government integration", "KYC for Chinese users", "Travel booking"],
13
+ "seoTitle": "Chinese Resident ID Regex — Validate 身份证号",
14
+ "seoDescription": "Regex for Chinese national resident identity card number (18 characters) validation."
15
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "slug": "coordinates",
3
+ "name": "GPS Coordinates",
4
+ "description": "Matches a latitude,longitude coordinate pair separated by a comma.",
5
+ "category": "Geo",
6
+ "pattern": "-?([0-8]?\\d(\\.\\d+)?|90(\\.0+)?)\\s*,\\s*-?(1[0-7]\\d(\\.\\d+)?|[0-9]?\\d(\\.\\d+)?|180(\\.0+)?)",
7
+ "flags": "",
8
+ "examples": ["51.5074,-0.1278", "40.7128, -74.0060", "-33.8688, 151.2093"],
9
+ "counterExamples": ["91.0,-0.1278", "51.5074,-181.0", "abc,def"],
10
+ "tags": ["coordinates", "gps", "geo", "location", "lat-lng"],
11
+ "useCases": ["Map input fields", "Geofencing", "Delivery address parsing"],
12
+ "seoTitle": "GPS Coordinates Regex — Validate Lat/Lng Pairs",
13
+ "seoDescription": "Regex for GPS coordinate pair (latitude, longitude) validation."
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "slug": "credit-card",
3
+ "name": "Credit Card Number",
4
+ "description": "Generic credit card number validator supporting Visa, Mastercard, American Express, and Discover card formats.",
5
+ "category": "Finance",
6
+ "pattern": "(?:4[0-9]{12}(?:[0-9]{3})?|[25][1-7][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11})",
7
+ "flags": "",
8
+ "examples": ["4111111111111111", "5500005555555559", "371449635398431"],
9
+ "counterExamples": ["1234567890123456", "411111111111", "0000000000000000"],
10
+ "tags": ["payment", "credit-card", "finance", "visa", "mastercard", "amex"],
11
+ "useCases": ["Payment form validation", "E-commerce checkout", "Subscription billing"],
12
+ "seoTitle": "Credit Card Regex — Validate Card Numbers in JS, Go, PHP",
13
+ "seoDescription": "Regex for validating Visa, Mastercard, Amex, and Discover credit card numbers. Generate code for JavaScript, Go, PHP."
14
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "slug": "crypto-mnemonic-word",
3
+ "name": "BIP-39 Mnemonic Phrase",
4
+ "description": "Matches a BIP-39 mnemonic seed phrase — 12, 15, 18, 21, or 24 lowercase English words separated by single spaces.",
5
+ "category": "Crypto",
6
+ "pattern": "^([a-z]+\\s){11,23}[a-z]+$",
7
+ "flags": "",
8
+ "examples": [
9
+ "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
10
+ "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong"
11
+ ],
12
+ "counterExamples": ["abandon abandon", "ABANDON ABANDON ABANDON", "abandon double-space"],
13
+ "tags": ["bip39", "mnemonic", "seed", "wallet", "crypto", "recovery"],
14
+ "useCases": ["Wallet backup verification", "Seed phrase format validation", "Crypto onboarding"],
15
+ "seoTitle": "BIP-39 Mnemonic Regex — Validate Seed Phrases",
16
+ "seoDescription": "Regex for BIP-39 mnemonic seed phrase format validation (12–24 words)."
17
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "slug": "date-eu",
3
+ "name": "Date (European Format)",
4
+ "description": "Matches a European-style date in DD/MM/YYYY, DD.MM.YYYY, or DD-MM-YYYY format.",
5
+ "category": "Date & Time",
6
+ "pattern": "(0?[1-9]|[12]\\d|3[01])[.\\-\\/](0?[1-9]|1[0-2])[.\\-\\/](\\d{4})",
7
+ "flags": "",
8
+ "examples": ["15/01/2024", "31.12.1999", "7-3-2024"],
9
+ "counterExamples": ["01/13/2024", "00/15/2024", "2024/01/15"],
10
+ "tags": ["date", "european", "dd/mm/yyyy", "eu"],
11
+ "useCases": ["European forms", "Date input validation", "Localized apps"],
12
+ "seoTitle": "European Date Format Regex — Validate DD/MM/YYYY in JS, Go, PHP",
13
+ "seoDescription": "Regex for European date DD/MM/YYYY, DD.MM.YYYY, DD-MM-YYYY formats."
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "slug": "date-us",
3
+ "name": "Date (US Format)",
4
+ "description": "Matches a US-style date in MM/DD/YYYY format.",
5
+ "category": "Date & Time",
6
+ "pattern": "(0?[1-9]|1[0-2])\\/(0?[1-9]|[12]\\d|3[01])\\/(\\d{4})",
7
+ "flags": "",
8
+ "examples": ["01/15/2024", "12/31/1999", "3/7/2024"],
9
+ "counterExamples": ["13/01/2024", "00/15/2024", "2024/01/15", "15/01/2024"],
10
+ "tags": ["date", "us", "mm/dd/yyyy", "american"],
11
+ "useCases": ["US address forms", "American date input fields", "Legacy system integration"],
12
+ "seoTitle": "US Date Format Regex — Validate MM/DD/YYYY in JS, Go, PHP",
13
+ "seoDescription": "Regex for US date format MM/DD/YYYY validation."
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "slug": "datetime-iso",
3
+ "name": "ISO 8601 DateTime",
4
+ "description": "Matches an ISO 8601 datetime string with timezone offset or Z (UTC).",
5
+ "category": "Date & Time",
6
+ "pattern": "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})",
7
+ "flags": "",
8
+ "examples": ["2024-01-15T10:30:00Z", "2024-01-15T10:30:00.000Z", "2024-01-15T10:30:00+02:00"],
9
+ "counterExamples": ["2024-01-15 10:30:00", "2024-01-15T10:30:00", "not-a-date"],
10
+ "tags": ["iso8601", "datetime", "timestamp", "utc"],
11
+ "useCases": ["API request/response validation", "Database timestamp parsing", "Log file parsing"],
12
+ "seoTitle": "ISO 8601 DateTime Regex — Validate Timestamps in JS, Go, PHP",
13
+ "seoDescription": "Regex for ISO 8601 datetime with timezone. Covers Z and ±HH:MM offsets."
14
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "slug": "de-plz",
3
+ "name": "German Postal Code (PLZ)",
4
+ "description": "Matches a German postal code (Postleitzahl / PLZ) — exactly 5 digits.",
5
+ "category": "Address",
6
+ "pattern": "\\d{5}",
7
+ "flags": "",
8
+ "examples": ["10115", "80331", "20095", "01067"],
9
+ "counterExamples": ["1234", "123456", "A1234"],
10
+ "locales": ["de"],
11
+ "tags": ["plz", "postal", "germany", "german", "address"],
12
+ "useCases": ["German address forms", "Delivery validation", "Tax region determination"],
13
+ "seoTitle": "German PLZ Regex — Validate German Postal Codes",
14
+ "seoDescription": "Regex for German postal code (PLZ) validation — 5 digits."
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "slug": "de-steuerid",
3
+ "name": "German Tax ID (Steuer-IdNr)",
4
+ "description": "Matches a German personal tax identification number (Steuerliche Identifikationsnummer) — 11 digits, first digit 1–9.",
5
+ "category": "Identity",
6
+ "pattern": "[1-9]\\d{10}",
7
+ "flags": "",
8
+ "examples": ["12345678901", "98765432109"],
9
+ "counterExamples": ["0123456789", "1234567890", "1234567890A"],
10
+ "locales": ["de"],
11
+ "tags": ["steuerid", "germany", "german", "tax", "identity"],
12
+ "useCases": ["German tax forms", "Payroll systems", "ELSTER integration"],
13
+ "seoTitle": "German Tax ID Regex — Validate Steuer-IdNr",
14
+ "seoDescription": "Regex for German personal tax identification number (Steuer-IdNr) validation."
15
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "slug": "domain",
3
+ "name": "Domain Name",
4
+ "description": "Matches a valid domain name including subdomains and international TLDs.",
5
+ "category": "Internet",
6
+ "pattern": "(?:[a-zA-Z0-9](?:[a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,}",
7
+ "flags": "i",
8
+ "examples": ["example.com", "sub.domain.co.uk", "my-site.io", "regex.to"],
9
+ "counterExamples": ["-invalid.com", "invalid-.com", ".com", "localhost"],
10
+ "tags": ["domain", "internet", "dns", "hostname"],
11
+ "useCases": ["DNS validation", "Link parsing", "Domain registration checks"],
12
+ "seoTitle": "Domain Name Regex — Validate Domains in JS, Go, PHP",
13
+ "seoDescription": "Regex for domain name validation including subdomains and modern TLDs."
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "slug": "email",
3
+ "name": "Email Address",
4
+ "description": "RFC 5321 compliant email address validation. Supports subdomains, plus-addressing, and international TLDs.",
5
+ "category": "Internet",
6
+ "pattern": "[a-zA-Z0-9._%+\\-]+@[a-zA-Z0-9.\\-]+\\.[a-zA-Z]{2,}",
7
+ "flags": "i",
8
+ "examples": ["user@example.com", "john.doe+tag@sub.domain.co.uk", "contact@regex.to"],
9
+ "counterExamples": ["plainaddress", "@missinglocal.com", "user@.com", "user@"],
10
+ "tags": ["email", "internet", "contact", "validation"],
11
+ "useCases": ["Contact form validation", "User registration", "Newsletter signups"],
12
+ "seoTitle": "Email Address Regex — Validate Email Patterns in JS, Go, PHP",
13
+ "seoDescription": "Copy the battle-tested email regex for JavaScript, TypeScript (Zod), Go, and PHP. Includes unit test generation and live testing."
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "slug": "ens-name",
3
+ "name": "ENS Name (Ethereum Name Service)",
4
+ "description": "Matches an Ethereum Name Service domain — alphanumeric label(s) ending with .eth.",
5
+ "category": "Crypto",
6
+ "pattern": "[a-z0-9][a-z0-9\\-]{1,61}[a-z0-9]\\.eth",
7
+ "flags": "i",
8
+ "examples": ["vitalik.eth", "my-wallet.eth", "regex.eth"],
9
+ "counterExamples": ["-invalid.eth", "a.eth", "vitalik.com", "vitalik.ETH2"],
10
+ "tags": ["ens", "ethereum", "domain", "web3", "naming"],
11
+ "useCases": ["Web3 profile lookup", "Wallet address resolution", "ENS search"],
12
+ "seoTitle": "ENS Name Regex — Validate .eth Domains",
13
+ "seoDescription": "Regex for Ethereum Name Service (ENS) .eth domain validation."
14
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "slug": "es-nif",
3
+ "name": "Spanish NIF / DNI",
4
+ "description": "Matches a Spanish National Identity Document number (NIF/DNI) — 8 digits followed by a letter, or an NIE starting with X, Y, or Z.",
5
+ "category": "Identity",
6
+ "pattern": "[0-9XYZ]\\d{7}[A-HJ-NP-TV-Z]",
7
+ "flags": "i",
8
+ "examples": ["12345678Z", "X1234567L", "Y0000000T"],
9
+ "counterExamples": ["1234567Z", "123456789Z", "12345678I"],
10
+ "locales": ["es"],
11
+ "tags": ["nif", "dni", "nie", "spain", "spanish", "identity"],
12
+ "useCases": ["Spanish government forms", "Bank KYC", "Online identity verification"],
13
+ "seoTitle": "Spanish NIF/DNI Regex — Validate Spanish ID Numbers",
14
+ "seoDescription": "Regex for Spanish NIF, DNI and NIE number validation."
15
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "slug": "ethereum-address",
3
+ "name": "Ethereum Address",
4
+ "description": "Matches an Ethereum address — 0x followed by exactly 40 hexadecimal characters.",
5
+ "category": "Crypto",
6
+ "pattern": "0x[a-fA-F0-9]{40}",
7
+ "flags": "i",
8
+ "examples": ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e", "0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe"],
9
+ "counterExamples": ["742d35Cc6634C0532925a3b844Bc454e4438f44e", "0x742d35Cc6634C0532925a3b844Bc454e4438f44", "0xGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG"],
10
+ "tags": ["ethereum", "eth", "evm", "crypto", "address", "blockchain"],
11
+ "useCases": ["Crypto payment validation", "Smart contract interaction", "DeFi apps"],
12
+ "seoTitle": "Ethereum Address Regex — Validate ETH Addresses",
13
+ "seoDescription": "Regex for Ethereum (and EVM) address validation."
14
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "slug": "fr-postal",
3
+ "name": "French Postal Code",
4
+ "description": "Matches a French postal code — exactly 5 digits, starting with 0–9.",
5
+ "category": "Address",
6
+ "pattern": "0[1-9]\\d{3}|[1-8]\\d{4}|9[0-5]\\d{3}",
7
+ "flags": "",
8
+ "examples": ["75001", "69001", "13001", "06000"],
9
+ "counterExamples": ["00000", "99000", "1234", "750011"],
10
+ "locales": ["fr"],
11
+ "tags": ["postal", "france", "french", "address", "cp"],
12
+ "useCases": ["French address forms", "VAT region detection", "Delivery zones"],
13
+ "seoTitle": "French Postal Code Regex — Validate French ZIP Codes",
14
+ "seoDescription": "Regex for French postal code (code postal) validation."
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "slug": "fr-siren",
3
+ "name": "French SIREN Number",
4
+ "description": "Matches a French SIREN (Système d'Identification du Répertoire des ENtreprises) number — 9 digits.",
5
+ "category": "Identity",
6
+ "pattern": "\\d{9}",
7
+ "flags": "",
8
+ "examples": ["732829320", "404833048", "123456789"],
9
+ "counterExamples": ["73282932", "7328293200", "73282932A"],
10
+ "locales": ["fr"],
11
+ "tags": ["siren", "france", "company", "business", "tax"],
12
+ "useCases": ["French business identification", "Trade register lookups", "Tax forms"],
13
+ "seoTitle": "French SIREN Regex — Validate SIREN Numbers",
14
+ "seoDescription": "Regex for French SIREN company identifier (9 digits) validation."
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "slug": "fr-siret",
3
+ "name": "French SIRET Number",
4
+ "description": "Matches a French SIRET (Système d'Identification du Répertoire des Établissements) number — 14 digits.",
5
+ "category": "Identity",
6
+ "pattern": "\\d{14}",
7
+ "flags": "",
8
+ "examples": ["73282932000074", "40483304800022"],
9
+ "counterExamples": ["7328293200007", "732829320000741", "73282932000074A"],
10
+ "locales": ["fr"],
11
+ "tags": ["siret", "france", "company", "tax", "business"],
12
+ "useCases": ["French business registration", "Invoice validation", "B2B onboarding"],
13
+ "seoTitle": "French SIRET Regex — Validate SIRET Numbers",
14
+ "seoDescription": "Regex for French SIRET company identifier (14 digits) validation."
15
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "slug": "git-sha",
3
+ "name": "Git Commit SHA",
4
+ "description": "Matches a Git commit SHA — either short form (7+ chars) or full 40-character SHA-1 hash.",
5
+ "category": "Dev",
6
+ "pattern": "[0-9a-f]{7,40}",
7
+ "flags": "i",
8
+ "examples": ["a1b2c3d", "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2"],
9
+ "counterExamples": ["xyz", "ZZZZZZ", "123456"],
10
+ "tags": ["git", "sha", "commit", "version-control"],
11
+ "useCases": ["CI/CD pipelines", "Deployment tracking", "Code review tools"],
12
+ "seoTitle": "Git SHA Regex — Validate Git Commits in JS, Go, PHP",
13
+ "seoDescription": "Regex for Git commit SHA validation — short (7 chars) or full 40-char SHA-1."
14
+ }