regex-belt
v0.1.21
Published
A collection of commonly used regular expressions, organized by category.
Downloads
238
Maintainers
Readme
regex-belt
A collection of hundreds battle-tested regular expressions you'd otherwise copy-paste from Stack Overflow.
Dates, documents, phone numbers, bank accounts, license plates — validated, tested, and ready to import.
Why regex-belt?
- No more regex roulette. Every pattern is tested against real-world valid and invalid inputs. No silent mismatches in production.
- Zero dependencies. Pure regex literals — no runtime overhead, no transitive surprises.
- Tree-shakeable. Import only what you need. Your bundler drops the rest.
- Self-documenting. This README is auto-generated from JSDoc in the source — the docs are always in sync with the code.
Install
npm install regex-belt
# or
pnpm add regex-belt
# or
yarn add regex-beltImport
import { datetime, countries } from 'regex-belt';
import { RegexBelt } from 'regex-belt';
import RegexBelt from 'regex-belt';Quick start
import { datetime, countries } from 'regex-belt';
// Validate a date
datetime.dashedDate.test('2022-12-31'); // true
// Validate a Brazilian CPF
countries.br.documents.cpf.test('123.456.789-09'); // true
// Validate a phone number
countries.br.contact.phone.test('+55 11 91234-5678'); // trueEvery regex is a plain RegExp literal — use .test(), .match(), or .exec() as you normally would.
Adding a new regex
Each regex requires four things: the regex file, a test fixture, a test file, and barrel export wiring.
1. Create the regex file
Add your file under src/regexen/ following the existing directory structure (e.g. src/regexen/countries/br/contact/cep.ts).
Every exported regex must have a JSDoc block with a description, optional notes wrapped in triple underscores, and @example tags with match indicators:
/**
* Matches a Brazilian CEP (postal code) in the format XXXXX-XXX
*
* ___Enforces beginning and end of string___
* @example ✅ '01001-000'
* @example ❌ '01001000'
*/
export const cepFormatted = /^(?:0[1-9]|[1-9]\d)\d{3}-\d{3}$/;The @example format is strictly validated — each line must be @example ✅|❌ <value>.
2. Create test fixtures
Add a matching fixture file under src/fixtures/ mirroring the regex path (e.g. src/fixtures/countries/br/contact/cep.ts).
Export objects with descriptive keys for valid and invalid cases:
export const validCepFormatted = {
saoPauloCentro: '01001-000',
standard: '12345-678',
};
export const invalidCepFormatted = {
noDash: '01001000',
tooShort: '0100-000',
};3. Create the test file
Add a .test.ts file next to the regex file. Tests use Vitest and iterate over fixture entries:
import { describe, expect, it } from 'vitest';
import { validCepFormatted, invalidCepFormatted } from '@src/fixtures/countries/br/contact/cep.ts';
import { cepFormatted } from './cep.ts';
describe('cepFormatted', () => {
it.each(Object.entries(validCepFormatted))('%s: %s', (_, value) => {
expect(cepFormatted.test(value)).toBe(true);
});
it.each(Object.entries(invalidCepFormatted))('%s: %s', (_, value) => {
expect(cepFormatted.test(value)).toBe(false);
});
});4. Wire up barrel exports
Add an export * from './your-file.ts' line to the _index.ts in the same directory. If the directory is new, create a _index.ts and export it from the parent _index.ts.
5. Verify and generate
pnpm check-all # Run all checks before it can be published6. Open a PR
That's it
Available REGEXEN
Datetime
dashedDateLoose — ✅ '2022-12-31' — Matches a date in the format YYYY-MM-DD Valid digits are 0000 to 9999 for year, 01 to 12 for month and 01 to 31 for day (Does not enforce beginning and end of string)
/([0-9]{4}-([0][1-9]|[1][0-2])-([1-2][0-9]|[0][1-9]|[3][0-1]))/| Input | Match |
|:------|:-----:|
| 2022-12-31 | ✅ |
| 2022-12-31T23:59:59.999Z | ✅ |
| 9992022-12-31 | ✅ |
Last updated: 2026-04-08
dashedDate — ✅ '2022-12-31' — Matches a date in the format YYYY-MM-DD Valid digits are 0000 to 9999 for year, 01 to 12 for month and 01 to 31 for day. (Enforces beginning and end of string)
/^([0-9]{4}-([0][1-9]|[1][0-2])-([1-2][0-9]|[0][1-9]|[3][0-1]))$/| Input | Match |
|:------|:-----:|
| 2022-12-31 | ✅ |
| 2022-12-31T23:59:59.999Z | ❌ |
| 9992022-12-31 | ❌ |
Last updated: 2026-04-08
isoUtc — ✅ '2022-12-31T23:59:59.999Z' — Regex that matches a UTC ISO String Date in format YYYY-MM-DDTHH:mm:ss.sssZ
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/| Input | Match |
|:------|:-----:|
| 2022-12-31T23:59:59.999Z | ✅ |
| 2022-12-31T23:59:59Z | ✅ |
Last updated: 2026-04-08
Datetime / Iso8601
datetimeWithTz — ✅ '2022-12-31T23:59:59Z' — Matches an ISO-8601 datetime with required timezone Format: YYYY-MM-DDTHH:mm:ss.mmm (Enforces beginning and end of string)
/^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d{1,3})?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/| Input | Match |
|:------|:-----:|
| 2022-12-31T23:59:59Z | ✅ |
| 2022-12-31T23:59:59.999+05:30 | ✅ |
| 2022-12-31T23:59:59-03:00 | ✅ |
| 2022-12-31T23:59:59 | ❌ |
| 2022-12-31 | ❌ |
Last updated: 2026-04-09
datetimeWithoutTz — ✅ '2022-12-31T23:59:59' — Matches an ISO-8601 datetime without timezone Format: YYYY-MM-DDTHH:mm:ss[.mmm] (Enforces beginning and end of string)
/^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d{1,3})?$/| Input | Match |
|:------|:-----:|
| 2022-12-31T23:59:59 | ✅ |
| 2022-12-31T23:59:59.999 | ✅ |
| 2022-12-31T23:59:59Z | ❌ |
| 2022-12-31T23:59:59+05:30 | ❌ |
Last updated: 2026-04-09
standard — ✅ '2022-12-31T23:59:59.999Z' — Matches an ISO-8601 datetime with optional timezone Format: YYYY-MM-DDTHH:mm:ss[.mmm][Z|±HH:mm] (Enforces beginning and end of string)
/^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d{1,3})?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)?$/| Input | Match |
|:------|:-----:|
| 2022-12-31T23:59:59.999Z | ✅ |
| 2022-12-31T23:59:59+05:30 | ✅ |
| 2022-12-31T23:59:59 | ✅ |
| 2022-12-31 | ❌ |
| not-a-date | ❌ |
Last updated: 2026-04-09
Datetime / Time-12h
hh — ✅ '12' — Matches a 12-hour hour in HH format without meridiem (Enforces beginning and end of string)
/^(?:0?[1-9]|1[0-2])$/| Input | Match |
|:------|:-----:|
| 12 | ✅ |
| 1 | ✅ |
| 0 | ❌ |
| 12 PM | ❌ |
Last updated: 2026-04-09
hhAMPM — ✅ '12 PM' — Matches a 12-hour hour in HH AM/PM format (Enforces beginning and end of string)
/^(?:0?[1-9]|1[0-2])\s?[AaPp][Mm]$/| Input | Match |
|:------|:-----:|
| 12 PM | ✅ |
| 1 AM | ✅ |
| 0 AM | ❌ |
| 13 PM | ❌ |
Last updated: 2026-04-09
hhmm — ✅ '12:59' — Matches a 12-hour time in HH:MM format without meridiem (Enforces beginning and end of string)
/^(?:0?[1-9]|1[0-2]):[0-5]\d$/| Input | Match |
|:------|:-----:|
| 12:59 | ✅ |
| 01:00 | ✅ |
| 00:00 | ❌ |
| 12:59 PM | ❌ |
Last updated: 2026-04-09
hhmmAMPM — ✅ '12:59 PM' — Matches a 12-hour time in HH:MM AM/PM format (Enforces beginning and end of string)
/^(?:0?[1-9]|1[0-2]):[0-5]\d\s?[AaPp][Mm]$/| Input | Match |
|:------|:-----:|
| 12:59 PM | ✅ |
| 01:00 AM | ✅ |
| 00:00 AM | ❌ |
| 13:00 PM | ❌ |
Last updated: 2026-04-09
hhmmss — ✅ '12:59:59' — Matches a 12-hour time in HH:MM:SS format without meridiem (Enforces beginning and end of string)
/^(?:0?[1-9]|1[0-2]):[0-5]\d:[0-5]\d$/| Input | Match |
|:------|:-----:|
| 12:59:59 | ✅ |
| 01:00:00 | ✅ |
| 00:00:00 | ❌ |
| 12:59:59 PM | ❌ |
Last updated: 2026-04-09
hhmmssAMPM — ✅ '12:59:59 PM' — Matches a 12-hour time in HH:MM:SS AM/PM format (Enforces beginning and end of string)
/^(?:0?[1-9]|1[0-2]):[0-5]\d:[0-5]\d\s?[AaPp][Mm]$/| Input | Match |
|:------|:-----:|
| 12:59:59 PM | ✅ |
| 01:00:00 AM | ✅ |
| 00:00:00 AM | ❌ |
| 13:00:00 PM | ❌ |
Last updated: 2026-04-09
Datetime / Time-24h
hh — ✅ '23' — Matches a 24-hour hour in HH format (Enforces beginning and end of string)
/^(?:[01]\d|2[0-3])$/| Input | Match |
|:------|:-----:|
| 23 | ✅ |
| 00 | ✅ |
| 24 | ❌ |
| 5 | ❌ |
Last updated: 2026-04-09
hhmm — ✅ '23:59' — Matches a 24-hour time in HH:MM format (Enforces beginning and end of string)
/^(?:[01]\d|2[0-3]):[0-5]\d$/| Input | Match |
|:------|:-----:|
| 23:59 | ✅ |
| 00:00 | ✅ |
| 24:00 | ❌ |
| 23:59:59 | ❌ |
Last updated: 2026-04-09
hhmmss — ✅ '23:59:59' — Matches a 24-hour time in HH:MM:SS format (Enforces beginning and end of string)
/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/| Input | Match |
|:------|:-----:|
| 23:59:59 | ✅ |
| 00:00:00 | ✅ |
| 24:00:00 | ❌ |
| 23:59 | ❌ |
Last updated: 2026-04-09
Math / Decimal
any — ✅ '1.5' — Matches any decimal number including negative (no leading zeros except before the dot) (Enforces beginning and end of string)
/^-?(?:0|[1-9]\d*)\.\d+$/| Input | Match |
|:------|:-----:|
| 1.5 | ✅ |
| -0.123 | ✅ |
| 0.0 | ✅ |
| 1 | ❌ |
| -1 | ❌ |
Last updated: 2026-04-09
negative — ✅ '-1.5' — Matches a negative decimal number (no leading zeros except before the dot) (Enforces beginning and end of string)
/^-(?:0|[1-9]\d*)\.\d+$/| Input | Match |
|:------|:-----:|
| -1.5 | ✅ |
| -0.123 | ✅ |
| 1.5 | ❌ |
| -1 | ❌ |
Last updated: 2026-04-09
positive — ✅ '1.5' — Matches a positive decimal number (no leading zeros except before the dot) (Enforces beginning and end of string)
/^(?:0|[1-9]\d*)\.\d+$/| Input | Match |
|:------|:-----:|
| 1.5 | ✅ |
| 0.123 | ✅ |
| 123.456 | ✅ |
| -1.5 | ❌ |
| 1 | ❌ |
Last updated: 2026-04-09
Math / Integer
any — ✅ '0' — Matches any integer including zero (no leading zeros except for zero itself) (Enforces beginning and end of string)
/^(?:0|-?[1-9]\d*)$/| Input | Match |
|:------|:-----:|
| 0 | ✅ |
| 123 | ✅ |
| -456 | ✅ |
| 01 | ❌ |
| 1.5 | ❌ |
Last updated: 2026-04-09
negative — ✅ '-1' — Matches a negative integer (less than zero, no leading zeros) (Enforces beginning and end of string)
/^-[1-9]\d*$/| Input | Match |
|:------|:-----:|
| -1 | ✅ |
| -123 | ✅ |
| 0 | ❌ |
| 1 | ❌ |
| -01 | ❌ |
Last updated: 2026-04-09
positive — ✅ '1' — Matches a positive integer (greater than zero, no leading zeros) (Enforces beginning and end of string)
/^[1-9]\d*$/| Input | Match |
|:------|:-----:|
| 1 | ✅ |
| 123 | ✅ |
| 0 | ❌ |
| -1 | ❌ |
| 01 | ❌ |
Last updated: 2026-04-09
Network / Routing
ipv4 — ✅ '192.168.1.1' — Matches a valid IPv4 address (four octets 0-255 separated by dots) (Enforces beginning and end of string)
/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)$/| Input | Match |
|:------|:-----:|
| 192.168.1.1 | ✅ |
| 0.0.0.0 | ✅ |
| 255.255.255.255 | ✅ |
| 256.0.0.1 | ❌ |
| 192.168.1 | ❌ |
Last updated: 2026-04-09
ipv6 — ✅ '2001:0db8:85a3:0000:0000:8a2e:0370:7334' — Matches a valid IPv6 address including compressed and mixed notation Supports full addresses, :: compression, and embedded IPv4 (Enforces beginning and end of string)
/^(?:(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,7}:|(?:[0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,5}(?::[0-9a-fA-F]{1,4}){1,2}|(?:[0-9a-fA-F]{1,4}:){1,4}(?::[0-9a-fA-F]{1,4}){1,3}|(?:[0-9a-fA-F]{1,4}:){1,3}(?::[0-9a-fA-F]{1,4}){1,4}|(?:[0-9a-fA-F]{1,4}:){1,2}(?::[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:(?::[0-9a-fA-F]{1,4}){1,6}|:(?:(?::[0-9a-fA-F]{1,4}){1,7}|:)|::(?:ffff(?::0{1,4})?:)?(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)|(?:[0-9a-fA-F]{1,4}:){1,4}:(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d))$/| Input | Match |
|:------|:-----:|
| 2001:0db8:85a3:0000:0000:8a2e:0370:7334 | ✅ |
| ::1 | ✅ |
| fe80::1 | ✅ |
| ::ffff:192.168.1.1 | ✅ |
| 2001:db8::85a3::7334 | ❌ |
| 192.168.1.1 | ❌ |
Last updated: 2026-04-09
Network / URL
commonPublicDomainOnly — ✅ 'https://example.com' — Matches a public HTTP/HTTPS URL with only the domain Format: scheme://host (Enforces beginning and end of string)
/^https?:\/\/(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/| Input | Match |
|:------|:-----:|
| https://example.com | ✅ |
| http://sub.example.com | ✅ |
| https://example.com/path | ❌ |
| https://example.com:8080 | ❌ |
| ftp://files.example.com | ❌ |
Last updated: 2026-04-09
commonPublic — ✅ 'https://example.com/path?q=1' — Matches a common public HTTP/HTTPS URL without credentials Format: scheme://host[:port][/path][?query][#fragment] (Enforces beginning and end of string)
/^https?:\/\/(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?::\d{1,5})?(?:\/[^\s?#]*)?(?:\?[^\s#]*)?(?:#[^\s]*)?$/| Input | Match |
|:------|:-----:|
| https://example.com/path?q=1 | ✅ |
| http://example.com:3000 | ✅ |
| https://user:[email protected] | ❌ |
| ftp://files.example.com | ❌ |
Last updated: 2026-04-09
ftp — ✅ 'ftp://files.example.com' — Matches an FTP URL with all optional components Format: ftp://[credentials@]host[:port][/path][?query][#fragment] (Enforces beginning and end of string)
/^ftp:\/\/(?:(?:[a-zA-Z0-9._~!{{GENERATED_CONTENT}}'()*+,;=:%-]+@))?(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?::\d{1,5})?(?:\/[^\s?#]*)?(?:\?[^\s#]*)?(?:#[^\s]*)?$/| Input | Match |
|:------|:-----:|
| ftp://files.example.com | ✅ |
| ftp://user:[email protected]:21/pub | ✅ |
| https://example.com | ❌ |
| http://example.com | ❌ |
Last updated: 2026-04-09
full — ✅ 'https://user:[email protected]:8080/path?q=1#frag' — Matches a full URL with all optional components Format: scheme://[credentials@]host[:port][/path][?query][#fragment] (Enforces beginning and end of string)
/^(?:https?|ftp):\/\/(?:(?:[a-zA-Z0-9._~!{{GENERATED_CONTENT}}'()*+,;=:%-]+@))?(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?::\d{1,5})?(?:\/[^\s?#]*)?(?:\?[^\s#]*)?(?:#[^\s]*)?$/| Input | Match |
|:------|:-----:|
| https://user:[email protected]:8080/path?q=1#frag | ✅ |
| http://example.com | ✅ |
| ftp://files.example.com/pub | ✅ |
| example.com | ❌ |
| //example.com | ❌ |
Last updated: 2026-04-09
http — ✅ 'http://example.com' — Matches an HTTP URL with all optional components Format: http://[credentials@]host[:port][/path][?query][#fragment] (Enforces beginning and end of string)
/^http:\/\/(?:(?:[a-zA-Z0-9._~!{{GENERATED_CONTENT}}'()*+,;=:%-]+@))?(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?::\d{1,5})?(?:\/[^\s?#]*)?(?:\?[^\s#]*)?(?:#[^\s]*)?$/| Input | Match |
|:------|:-----:|
| http://example.com | ✅ |
| http://user:[email protected]:8080/path | ✅ |
| https://example.com | ❌ |
| ftp://files.example.com | ❌ |
Last updated: 2026-04-09
httpsDomainOnly — ✅ 'https://example.com' — Matches an HTTPS URL with only the domain Format: https://host (Enforces beginning and end of string)
/^https:\/\/(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/| Input | Match |
|:------|:-----:|
| https://example.com | ✅ |
| https://sub.example.com | ✅ |
| https://example.com/path | ❌ |
| http://example.com | ❌ |
| https://example.com:443 | ❌ |
Last updated: 2026-04-09
https — ✅ 'https://example.com' — Matches an HTTPS URL with all optional components Format: https://[credentials@]host[:port][/path][?query][#fragment] (Enforces beginning and end of string)
/^https:\/\/(?:(?:[a-zA-Z0-9._~!{{GENERATED_CONTENT}}'()*+,;=:%-]+@))?(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?::\d{1,5})?(?:\/[^\s?#]*)?(?:\?[^\s#]*)?(?:#[^\s]*)?$/| Input | Match |
|:------|:-----:|
| https://example.com | ✅ |
| https://user:[email protected]:443/path?q=1#frag | ✅ |
| http://example.com | ❌ |
| ftp://files.example.com | ❌ |
Last updated: 2026-04-09
noCredentials — ✅ 'https://example.com:8080/path?q=1' — Matches a URL without credentials Format: scheme://host[:port][/path][?query][#fragment] (Enforces beginning and end of string)
/^(?:https?|ftp):\/\/(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?::\d{1,5})?(?:\/[^\s?#]*)?(?:\?[^\s#]*)?(?:#[^\s]*)?$/| Input | Match |
|:------|:-----:|
| https://example.com:8080/path?q=1 | ✅ |
| http://example.com | ✅ |
| https://user:[email protected] | ❌ |
Last updated: 2026-04-09
noPathAndQuery — ✅ 'https://example.com' — Matches a URL without path, query, or fragment components Format: scheme://[credentials@]host[:port] (Enforces beginning and end of string)
/^(?:https?|ftp):\/\/(?:(?:[a-zA-Z0-9._~!{{GENERATED_CONTENT}}'()*+,;=:%-]+@))?(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?::\d{1,5})?$/| Input | Match |
|:------|:-----:|
| https://example.com | ✅ |
| https://user:[email protected]:8080 | ✅ |
| https://example.com/path | ❌ |
| https://example.com?q=1 | ❌ |
Last updated: 2026-04-09
noPort — ✅ 'https://user:[email protected]/path' — Matches a URL without a port component Format: scheme://[credentials@]host[/path][?query][#fragment] (Enforces beginning and end of string)
/^(?:https?|ftp):\/\/(?:(?:[a-zA-Z0-9._~!{{GENERATED_CONTENT}}'()*+,;=:%-]+@))?(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?:\/[^\s?#]*)?(?:\?[^\s#]*)?(?:#[^\s]*)?$/| Input | Match |
|:------|:-----:|
| https://user:[email protected]/path | ✅ |
| http://example.com | ✅ |
| https://example.com:8080 | ❌ |
Last updated: 2026-04-09
slug — ✅ 'my-page-title' — Matches a valid URL slug (lowercase alphanumeric with hyphens) (Enforces beginning and end of string)
/^[a-z0-9-]+$/| Input | Match |
|:------|:-----:|
| my-page-title | ✅ |
| post123 | ✅ |
| a | ✅ |
| My Page | ❌ |
| UPPERCASE | ❌ |
| has_underscore | ❌ |
Last updated: 2026-04-09
Vendors / Youtube
youtubeChannelId — ✅ 'https://www.youtube.com/channel/UC1234567890abcdefghijkl' — Matches a YouTube channel URL and captures the 22-character channel ID Channel URLs use the /channel/UC prefix followed by a 22-character ID (Does not enforce beginning and end of string)
/https?:\/\/(?:www\.)?youtube\.com\/channel\/UC[-_a-zA-Z0-9]{22}/i| Input | Match |
|:------|:-----:|
| https://www.youtube.com/channel/UC1234567890abcdefghijkl | ✅ |
| http://youtube.com/channel/UC1234567890abcdefghijkl | ✅ |
| https://youtube.com/user/somename | ❌ |
| https://example.com | ❌ |
Last updated: 2026-04-09
youtubeVideoId — ✅ 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' — Matches a YouTube video URL and captures the 11-character video ID Supports youtu.be short links and youtube.com/watch URLs with localized subdomains (Does not enforce beginning and end of string (matches within longer text))
/https?:\/\/(?:youtu\.be\/|(?:[a-z]{2,3}\.)?youtube\.com\/watch(?:\?|#!)v=)([\w-]{11})/i| Input | Match |
|:------|:-----:|
| https://www.youtube.com/watch?v=dQw4w9WgXcQ | ✅ |
| https://youtu.be/dQw4w9WgXcQ | ✅ |
| http://de.youtube.com/watch?v=dQw4w9WgXcQ | ✅ |
| https://example.com | ❌ |
| https://youtube.com/channel/UCxxxxxx | ❌ |
Last updated: 2026-04-09
WEB / Misc
email — ✅ '[email protected]' — Matches a basic email address (local part @ domain) Verifies the presence of @ with non-empty local and domain parts. For strict RFC 5322 validation, use a dedicated email validation library. (Enforces beginning and end of string)
/^.+@.+\..+$/| Input | Match |
|:------|:-----:|
| [email protected] | ✅ |
| [email protected] | ✅ |
| @example.com | ❌ |
| user@ | ❌ |
| plaintext | ❌ |
Last updated: 2026-04-09
WEB / Styles
hexColor — ✅ '#ff0000' — Matches an RGB hex color value with optional # prefix Supports both 3-digit and 6-digit hex notation (Enforces beginning and end of string)
/^#?(?:[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/| Input | Match |
|:------|:-----:|
| #ff0000 | ✅ |
| #FFF | ✅ |
| aabbcc | ✅ |
| #ff00 | ❌ |
| #gggggg | ❌ |
Last updated: 2026-04-09
Countries / BR / Codes
chaveNfe — ✅ '35210612345678000195550010001234561123456784' — Matches a Brazilian NFe (Nota Fiscal Eletronica) access key as 44 consecutive digits (Enforces beginning and end of string)
/^\d{44}$/| Input | Match |
|:------|:-----:|
| 35210612345678000195550010001234561123456784 | ✅ |
| 3521061234567800019555001000123456112345678 | ❌ |
Last updated: 2026-04-09
cnes — ✅ '1234567' — Matches a Brazilian CNES (Cadastro Nacional de Estabelecimentos de Saude) code as 7 digits (Enforces beginning and end of string)
/^\d{7}$/| Input | Match |
|:------|:-----:|
| 1234567 | ✅ |
| 123456 | ❌ |
Last updated: 2026-04-09
codigoIbge — ✅ '3550308' — Matches a Brazilian IBGE municipality code as 7 consecutive digits (Enforces beginning and end of string)
/^\d{7}$/| Input | Match |
|:------|:-----:|
| 3550308 | ✅ |
| 355030 | ❌ |
Last updated: 2026-04-09
ean13 — ✅ '7891234567890' — Matches an EAN-13 barcode as 13 consecutive digits (Enforces beginning and end of string)
/^\d{13}$/| Input | Match |
|:------|:-----:|
| 7891234567890 | ✅ |
| 789123456789 | ❌ |
Last updated: 2026-04-09
enem — ✅ '123456789012' — Matches a Brazilian ENEM registration number as 12 consecutive digits (Enforces beginning and end of string)
/^\d{12}$/| Input | Match |
|:------|:-----:|
| 123456789012 | ✅ |
| 12345678901 | ❌ |
Last updated: 2026-04-09
isbn13 — ✅ '9780306406157' — Matches an ISBN-13: prefix 978 or 979 followed by 10 digits (Enforces beginning and end of string)
/^(?:978|979)\d{10}$/| Input | Match |
|:------|:-----:|
| 9780306406157 | ✅ |
| 9770306406157 | ❌ |
Last updated: 2026-04-09
isbn10 — ✅ '0306406152' — Matches an ISBN-10: 9 digits followed by a check character (digit or uppercase X) (Enforces beginning and end of string)
/^\d{9}[\dX]$/| Input | Match |
|:------|:-----:|
| 0306406152 | ✅ |
| 123456789x | ❌ |
Last updated: 2026-04-09
registroProfissional — ✅ 'CREA123456SP' — Matches a Brazilian professional registration number (CREA, CRO, CRC, COREN, etc.) Format: CR + 1-3 uppercase letters + optional space + 4-10 digits + optional slash or dash + 2 uppercase state letters (Enforces beginning and end of string)
/^CR[A-Z]{1,3}\s?\d{4,10}[/-]?[A-Z]{2}$/| Input | Match |
|:------|:-----:|
| CREA123456SP | ✅ |
| crea123456sp | ❌ |
Last updated: 2026-04-09
Countries / BR / Contact
cepFormatted — ✅ '01001-000' — Matches a Brazilian CEP (postal code) in the format XXXXX-XXX Rejects the 00 prefix as no postal region 00 exists (lowest CEP is 01001-000) (Enforces beginning and end of string)
/^(?:0[1-9]|[1-9]\d)\d{3}-\d{3}$/| Input | Match |
|:------|:-----:|
| 01001-000 | ✅ |
| 01001000 | ❌ |
| 00000-000 | ❌ |
Last updated: 2026-04-09
cepStripped — ✅ '01001000' — Matches a Brazilian CEP (postal code) as 8 consecutive digits Rejects the 00 prefix as no postal region 00 exists (lowest CEP is 01001000) (Enforces beginning and end of string)
/^(?:0[1-9]|[1-9]\d)\d{6}$/| Input | Match |
|:------|:-----:|
| 01001000 | ✅ |
| 01001-000 | ❌ |
| 00000000 | ❌ |
Last updated: 2026-04-09
correiosTracking — ✅ 'SS987654321BR' — Matches a Brazilian Correios tracking code with 2 letters + 9 digits + 2 letters (Enforces beginning and end of string)
/^[A-Z]{2}\d{9}[A-Z]{2}$/| Input | Match |
|:------|:-----:|
| SS987654321BR | ✅ |
| ss987654321br | ❌ |
Last updated: 2026-04-09
phoneFormatted — ✅ '(11) 91234-5678' — Matches a Brazilian phone number with formatting Supports optional +55 country code, area code in parentheses, mobile (9-digit, starts with 9) or landline (8-digit), with dash separator (Enforces beginning and end of string)
/^(?:\+55\s)?(?:\(\d{2}\)\s)(?:9\d{4}|\d{4})-\d{4}$/| Input | Match |
|:------|:-----:|
| (11) 91234-5678 | ✅ |
| +55 11 91234-5678 | ❌ |
Last updated: 2026-04-09
phoneStripped — ✅ '11912345678' — Matches a Brazilian phone number as 10 or 11 consecutive digits 2-digit area code followed by 8-digit landline or 9-digit mobile (starts with 9) (Enforces beginning and end of string)
/^\d{2}(?:9\d{8}|\d{8})$/| Input | Match |
|:------|:-----:|
| 11912345678 | ✅ |
| +55 (11) 91234-5678 | ❌ |
Last updated: 2026-04-09
phoneInternational — ✅ '+5519998665522' — Matches a Brazilian phone number in international dialing formats (digits only) Supports +55 country code, domestic trunk prefix (0), or bare area code, followed by 2-digit area code and 8-digit landline or 9-digit mobile (starts with 9) (Enforces beginning and end of string)
/^(?:\+55|0)?\d{2}(?:9\d{8}|\d{8})$/| Input | Match |
|:------|:-----:|
| +5519998665522 | ✅ |
| +5419998665522 | ❌ |
Last updated: 2026-04-09
Countries / BR / Documents
birthMarriageCertificate — ✅ '104753 01 55 2013 1 00025 003 1234567-89' — Matches a Brazilian birth or marriage certificate number in the national unified format XXXXXX XX XX XXXX X XXXXX XXX XXXXXXX-XX (Enforces beginning and end of string)
/^\d{6}\s\d{2}\s\d{2}\s\d{4}\s\d\s\d{5}\s\d{3}\s\d{7}-\d{2}$/| Input | Match |
|:------|:-----:|
| 104753 01 55 2013 1 00025 003 1234567-89 | ✅ |
| 1047530155201310002500312345678-9 | ❌ |
Last updated: 2026-04-09
cnh — ✅ '12345678901' — Matches a Brazilian CNH (driver's license) number as 11 consecutive digits (Enforces beginning and end of string)
/^\d{11}$/| Input | Match |
|:------|:-----:|
| 12345678901 | ✅ |
| 1234567890 | ❌ |
Last updated: 2026-04-09
cnpjAlphanumericFormatted — ✅ 'A1.B2C.D3E/F4G5-67' — Matches a Brazilian alphanumeric CNPJ in the format XX.XXX.XXX/XXXX-XX where X is a letter or digit, and the last 2 characters are digits (Enforces beginning and end of string)
/^[A-Za-z0-9]{2}\.[A-Za-z0-9]{3}\.[A-Za-z0-9]{3}\/[A-Za-z0-9]{4}-\d{2}$/| Input | Match |
|:------|:-----:|
| A1.B2C.D3E/F4G5-67 | ✅ |
| A1B2CD3EF4G567 | ❌ |
Last updated: 2026-04-09
cnpjAlphanumericStripped — ✅ 'A1B2CD3EF4G567' — Matches a Brazilian alphanumeric CNPJ as 12 alphanumeric characters followed by 2 digits (Enforces beginning and end of string)
/^[A-Za-z0-9]{12}\d{2}$/| Input | Match |
|:------|:-----:|
| A1B2CD3EF4G567 | ✅ |
| A1.B2C.D3E/F4G5-67 | ❌ |
Last updated: 2026-04-09
cnpjFormatted — ✅ '12.345.678/0001-95' — Matches a Brazilian CNPJ number in the format XX.XXX.XXX/XXXX-XX (Enforces beginning and end of string)
/^\d{2}\.\d{3}\.\d{3}\/\d{4}-\d{2}$/| Input | Match |
|:------|:-----:|
| 12.345.678/0001-95 | ✅ |
| 12345678000195 | ❌ |
Last updated: 2026-04-09
cnpjStripped — ✅ '12345678000195' — Matches a Brazilian CNPJ number as 14 consecutive digits (Enforces beginning and end of string)
/^\d{14}$/| Input | Match |
|:------|:-----:|
| 12345678000195 | ✅ |
| 12.345.678/0001-95 | ❌ |
Last updated: 2026-04-09
cns — ✅ '198765432100010' — Matches a Brazilian CNS (national health card) number starting with 1-2 or 7-9 followed by 14 digits (Enforces beginning and end of string)
/^(?:[12]\d{10}00[01]\d|[789]\d{14})$/| Input | Match |
|:------|:-----:|
| 198765432100010 | ✅ |
| 398765432100010 | ❌ |
Last updated: 2026-04-09
cpfFormatted — ✅ '123.456.789-09' — Matches a Brazilian CPF number in the format XXX.XXX.XXX-XX (Enforces beginning and end of string)
/^\d{3}\.\d{3}\.\d{3}-\d{2}$/| Input | Match |
|:------|:-----:|
| 123.456.789-09 | ✅ |
| 12345678909 | ❌ |
Last updated: 2026-04-08
cpfStripped — ✅ '12345678909' — Matches a Brazilian CPF number as 11 consecutive digits (Enforces beginning and end of string)
/^\d{11}$/| Input | Match |
|:------|:-----:|
| 12345678909 | ✅ |
| 123.456.789-09 | ❌ |
Last updated: 2026-04-08
crm — ✅ '12345SP' — Matches a Brazilian CRM (medical license) number as 5-6 digits followed by a 2-letter uppercase state code (Enforces beginning and end of string)
/^\d{5,6}[A-Z]{2}$/| Input | Match |
|:------|:-----:|
| 12345SP | ✅ |
| 12345sp | ❌ |
Last updated: 2026-04-09
ctps — ✅ '1234567' — Matches a Brazilian CTPS (work card) number as 7 consecutive digits (Enforces beginning and end of string)
/^\d{7}$/| Input | Match |
|:------|:-----:|
| 1234567 | ✅ |
| 123456 | ❌ |
Last updated: 2026-04-09
nis — ✅ '123.45678.90-1' — Matches a Brazilian NIS number in the format XXX.XXXXX.XX-X (Enforces beginning and end of string)
/^\d{3}\.\d{5}\.\d{2}-\d$/| Input | Match |
|:------|:-----:|
| 123.45678.90-1 | ✅ |
| 12345678901 | ❌ |
Last updated: 2026-04-09
passport — ✅ 'AB123456' — Matches a Brazilian passport number as 2 uppercase letters followed by 6 digits (Enforces beginning and end of string)
/^[A-Z]{2}\d{6}$/| Input | Match |
|:------|:-----:|
| AB123456 | ✅ |
| ab123456 | ❌ |
Last updated: 2026-04-09
pisPasepFormatted — ✅ '123.45678.90-1' — Matches a Brazilian PIS/PASEP number in the format XXX.XXXXX.XX-X (Enforces beginning and end of string)
/^\d{3}\.\d{5}\.\d{2}-\d$/| Input | Match |
|:------|:-----:|
| 123.45678.90-1 | ✅ |
| 12345678901 | ❌ |
Last updated: 2026-04-09
pisPasepStripped — ✅ '12345678901' — Matches a Brazilian PIS/PASEP number as 11 consecutive digits (Enforces beginning and end of string)
/^\d{11}$/| Input | Match |
|:------|:-----:|
| 12345678901 | ✅ |
| 123.45678.90-1 | ❌ |
Last updated: 2026-04-09
rgFormatted — ✅ '12.345.678-9' — Matches a Brazilian RG number in the format X.XXX.XXX-X or XX.XXX.XXX-X where the last character can be a digit or X (Enforces beginning and end of string)
/^\d{1,2}\.\d{3}\.\d{3}-[\dXx]$/| Input | Match |
|:------|:-----:|
| 12.345.678-9 | ✅ |
| 123456789 | ❌ |
Last updated: 2026-04-09
rgStripped — ✅ '123456789' — Matches a Brazilian RG number as 8 or 9 characters (7-8 digits followed by a digit or X) (Enforces beginning and end of string)
/^\d{7,8}[\dXx]$/| Input | Match |
|:------|:-----:|
| 123456789 | ✅ |
| 12.345.678-9 | ❌ |
Last updated: 2026-04-09
rne — ✅ 'G1234567' — Matches a Brazilian RNE (foreign national registry) number as a letter or digit followed by 6 digits and a letter or digit (Enforces beginning and end of string)
/^[A-Z\d]\d{6}[A-Z\d]$/| Input | Match |
|:------|:-----:|
| G1234567 | ✅ |
| g1234567 | ❌ |
Last updated: 2026-04-09
susCardFormatted — ✅ '123 4567 8901 2345' — Matches a Brazilian SUS card number in the format XXX XXXX XXXX XXXX (Enforces beginning and end of string)
/^\d{3}\s\d{4}\s\d{4}\s\d{4}$/| Input | Match |
|:------|:-----:|
| 123 4567 8901 2345 | ✅ |
| 123456789012345 | ❌ |
Last updated: 2026-04-09
susCardStripped — ✅ '123456789012345' — Matches a Brazilian SUS card number as 15 consecutive digits (Enforces beginning and end of string)
/^\d{15}$/| Input | Match |
|:------|:-----:|
| 123456789012345 | ✅ |
| 123 4567 8901 2345 | ❌ |
Last updated: 2026-04-09
voterRegistrationFormatted — ✅ '1234 5678 9012' — Matches a Brazilian voter registration number in the format XXXX XXXX XXXX (Enforces beginning and end of string)
/^\d{4}\s\d{4}\s\d{4}$/| Input | Match |
|:------|:-----:|
| 1234 5678 9012 | ✅ |
| 123456789012 | ❌ |
Last updated: 2026-04-09
voterRegistrationStripped — ✅ '123456789012' — Matches a Brazilian voter registration number as 12 consecutive digits (Enforces beginning and end of string)
/^\d{12}$/| Input | Match |
|:------|:-----:|
| 123456789012 | ✅ |
| 1234 5678 9012 | ❌ |
Last updated: 2026-04-09
Countries / BR / Financial
boletoFormatted — ✅ '23793.38128 60000.000003 00000.000408 1 84340000019900' — Matches a Brazilian boleto payment line in the formatted pattern XXXXX.XXXXX XXXXX.XXXXXX XXXXX.XXXXXX X XXXXXXXXXXXXXX (Enforces beginning and end of string)
/^\d{5}\.\d{5}\s\d{5}\.\d{6}\s\d{5}\.\d{6}\s\d\s\d{14}$/| Input | Match |
|:------|:-----:|
| 23793.38128 60000.000003 00000.000408 1 84340000019900 | ✅ |
| 23793381286000000000300000000408184340000019900 | ❌ |
Last updated: 2026-04-09
boletoStripped — ✅ '23793381286000000000300000000408184340000019900' — Matches a Brazilian boleto payment line as 47 consecutive digits (Enforces beginning and end of string)
/^\d{47}$/| Input | Match |
|:------|:-----:|
| 23793381286000000000300000000408184340000019900 | ✅ |
| 23793.38128 60000.000003 00000.000408 1 84340000019900 | ❌ |
Last updated: 2026-04-09
pixKey — ✅ '00020126580014br.gov.bcb.pix0136123e4567-e12b-12d1-a456-4266141740006304A13B' — Matches a Brazilian PIX EMV payload containing the BCB identifier (br.gov.bcb.pix) with numeric prefix and CRC suffix (Enforces beginning and end of string)
/^\d{14,20}[Bb][Rr]\.[Gg][Oo][Vv]\.[Bb][Cc][Bb]\.[Pp][Ii][Xx].+6304[\dA-Fa-f]{4}$/| Input | Match |
|:------|:-----:|
| 00020126580014br.gov.bcb.pix0136123e4567-e12b-12d1-a456-4266141740006304A13B | ✅ |
| 00020126580014com.example.pix0136123e45676304A13B | ❌ |
Last updated: 2026-04-09
pixRandomKey — ✅ '123e4567-e89b-12d3-a456-426614174000' — Matches a Brazilian PIX random key in UUID v4 lowercase format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (Enforces beginning and end of string)
/^[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}$/| Input | Match |
|:------|:-----:|
| 123e4567-e89b-12d3-a456-426614174000 | ✅ |
| 123E4567-E89B-12D3-A456-426614174000 | ❌ |
Last updated: 2026-04-09
Countries / BR / Financial / Bank-account
bancoC6 — ✅ '1234 1234567-8' — Matches a Banco C6 account format: Agencia XXXX | Conta XXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{7}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 1234567-8 | ✅ |
| 1234 12345678-9 | ❌ |
Last updated: 2026-04-09
bancoDoBrasil — ✅ '1234-5 12345678-9' — Matches a Banco do Brasil account format: Agencia XXXX-D | Conta XXXXXXXX-D (Enforces beginning and end of string)
/^\d{4}-[\dX]\s\d{8}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234-5 12345678-9 | ✅ |
| 1234-5 1234567-9 | ❌ |
Last updated: 2026-04-09
bancoOriginal — ✅ '1234 1234567-8' — Matches a Banco Original account format: Agencia XXXX | Conta XXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{7}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 1234567-8 | ✅ |
| 1234 12345678-9 | ❌ |
Last updated: 2026-04-09
banrisul — ✅ '1234 123456789-0' — Matches a Banrisul account format: Agencia XXXX | Conta XXXXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{9}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 123456789-0 | ✅ |
| 1234 12345678-0 | ❌ |
Last updated: 2026-04-09
bradesco — ✅ '1234-5 1234567-8' — Matches a Bradesco account format: Agencia XXXX-D | Conta XXXXXXX-D (Enforces beginning and end of string)
/^\d{4}-[\dX]\s\d{7}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234-5 1234567-8 | ✅ |
| 1234-5 12345678-9 | ❌ |
Last updated: 2026-04-09
brb — ✅ '1234 123456789-0' — Matches a BRB account format: Agencia XXXX | Conta XXXXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{9}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 123456789-0 | ✅ |
| 1234 12345678-0 | ❌ |
Last updated: 2026-04-09
bs2 — ✅ '1234 123456-7' — Matches a BS2 account format: Agencia XXXX | Conta XXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{6}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 123456-7 | ✅ |
| 1234 1234567-8 | ❌ |
Last updated: 2026-04-09
caixaEconomicaNew — ✅ '1234 0013123456789-0' — Matches a Caixa Economica new account format: Agencia XXXX | Conta XXXXXXXXXXXXXX-D (4-digit operation code + 9-digit account + check digit) (Enforces beginning and end of string)
/^\d{4}\s\d{4}\d{9}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 0013123456789-0 | ✅ |
| 1234 001312345678-0 | ❌ |
Last updated: 2026-04-09
caixaEconomica — ✅ '1234 00112345678-9' — Matches a Caixa Economica account format: Agencia XXXX | Conta XXXXXXXXXXX-D (3-digit operation code + 8-digit account + check digit) (Enforces beginning and end of string)
/^\d{4}\s\d{3}\d{8}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 00112345678-9 | ✅ |
| 1234 0012345678-9 | ❌ |
Last updated: 2026-04-09
cora — ✅ '1234 1234567-8' — Matches a Cora account format: Agencia XXXX | Conta XXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{7}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 1234567-8 | ✅ |
| 1234 12345678-9 | ❌ |
Last updated: 2026-04-09
inter — ✅ '1234 123456789-0' — Matches an Inter account format: Agencia XXXX | Conta XXXXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{9}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 123456789-0 | ✅ |
| 1234 12345678-0 | ❌ |
Last updated: 2026-04-09
itau — ✅ '1234 12345-6' — Matches an Itau account format: Agencia XXXX | Conta XXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{5}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 12345-6 | ✅ |
| 1234 123456-7 | ❌ |
Last updated: 2026-04-09
mercadoPago — ✅ '1234 1234567890123-4' — Matches a Mercado Pago account format: Agencia XXXX | Conta XXXXXXXXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{13}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 1234567890123-4 | ✅ |
| 1234 123456789012-4 | ❌ |
Last updated: 2026-04-09
neon — ✅ '1234 123456789-0' — Matches a Neon account format: Agencia XXXX | Conta XXXXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{9}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 123456789-0 | ✅ |
| 1234 12345678-0 | ❌ |
Last updated: 2026-04-09
next — ✅ '1234 1234567-8' — Matches a Next account format: Agencia XXXX | Conta XXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{7}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 1234567-8 | ✅ |
| 1234 12345678-9 | ❌ |
Last updated: 2026-04-09
nubank — ✅ '1234 1234567890-1' — Matches a Nubank account format: Agencia XXXX | Conta XXXXXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{10}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 1234567890-1 | ✅ |
| 1234 123456789-0 | ❌ |
Last updated: 2026-04-09
pagseguro — ✅ '1234 12345678-9' — Matches a PagSeguro account format: Agencia XXXX | Conta XXXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{8}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 12345678-9 | ✅ |
| 1234 1234567-9 | ❌ |
Last updated: 2026-04-09
pjbank — ✅ '1234 1234567890-1' — Matches a PJBank account format: Agencia XXXX | Conta XXXXXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{10}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 1234567890-1 | ✅ |
| 1234 123456789-0 | ❌ |
Last updated: 2026-04-09
safra — ✅ '1234 12345678-9' — Matches a Safra account format: Agencia XXXX | Conta XXXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{8}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 12345678-9 | ✅ |
| 1234 1234567-9 | ❌ |
Last updated: 2026-04-09
santander — ✅ '1234 12345678-9' — Matches a Santander account format: Agencia XXXX | Conta XXXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{8}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 12345678-9 | ✅ |
| 1234 1234567-9 | ❌ |
Last updated: 2026-04-09
sicoob — ✅ '1234 123456789-0' — Matches a Sicoob account format: Agencia XXXX | Conta XXXXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{9}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 123456789-0 | ✅ |
| 1234 12345678-0 | ❌ |
Last updated: 2026-04-09
sicredi — ✅ '1234 123456' — Matches a Sicredi account format: Agencia XXXX | Conta XXXXXX (no check digit) (Enforces beginning and end of string)
/^\d{4}\s\d{6}$/| Input | Match |
|:------|:-----:|
| 1234 123456 | ✅ |
| 1234 1234567 | ❌ |
Last updated: 2026-04-09
stone — ✅ '1234 1234567-8' — Matches a Stone account format: Agencia XXXX | Conta XXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{7}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 1234567-8 | ✅ |
| 1234 12345678-9 | ❌ |
Last updated: 2026-04-09
unicred — ✅ '1234 12345678-9' — Matches a Unicred account format: Agencia XXXX | Conta XXXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{8}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 12345678-9 | ✅ |
| 1234 1234567-9 | ❌ |
Last updated: 2026-04-09
viaCredi — ✅ '1234 12345678901-2' — Matches a ViaCredi account format: Agencia XXXX | Conta XXXXXXXXXXX-D (Enforces beginning and end of string)
/^\d{4}\s\d{11}-[\dX]$/| Input | Match |
|:------|:-----:|
| 1234 12345678901-2 | ✅ |
| 1234 1234567890-2 | ❌ |
Last updated: 2026-04-09
Countries / BR / Government
cadasturFormatted — ✅ '12.345.678/0001-90' — Matches a Brazilian Cadastur number in the format XX.XXX.XXX/XXXX-XX (Enforces beginning and end of string)
/^\d{2}\.\d{3}\.\d{3}\/\d{4}-\d{2}$/| Input | Match |
|:------|:-----:|
| 12.345.678/0001-90 | ✅ |
| 12345678000190 | ❌ |
Last updated: 2026-04-09
cadasturStripped — ✅ '12345678000190' — Matches a Brazilian Cadastur number as 14 consecutive digits (Enforces beginning and end of string)
/^\d{14}$/| Input | Match |
|:------|:-----:|
| 12345678000190 | ✅ |
| 12.345.678/0001-90 | ❌ |
Last updated: 2026-04-09
caepf — ✅ '123.456.789-01/23' — Matches a Brazilian CAEPF number in the format XXX.XXX.XXX-XX/XX (Enforces beginning and end of string)
/^\d{3}\.\d{3}\.\d{3}-\d{2}\/\d{2}$/| Input | Match |
|:------|:-----:|
| 123.456.789-01/23 | ✅ |
| 123456789-01/23 | ❌ |
Last updated: 2026-04-09
caged — ✅ '1234567' — Matches a Brazilian CAGED number as 7 consecutive digits (Enforces beginning and end of string)
/^\d{7}$/| Input | Match |
|:------|:-----:|
| 1234567 | ✅ |
| 123456 | ❌ |
Last updated: 2026-04-09
cnjProcessFormatted — ✅ '0002028-80.2020.8.26.0100' — Matches a Brazilian CNJ process number in the format NNNNNNN-DD.AAAA.J.TR.OOOO (Enforces beginning and end of string)
/^\d{7}-\d{2}\.\d{4}\.[4-8]\.\d{2}\.\d{4}$/| Input | Match |
|:------|:-----:|
| 0002028-80.2020.8.26.0100 | ✅ |
| 00020288020208260100 | ❌ |
Last updated: 2026-04-09
cnjProcessStripped — ✅ '00020288020208260100' — Matches a Brazilian CNJ process number as 20 consecutive digits where the 16th digit is 4-8 (Enforces beginning and end of string)
/^\d{15}[4-8]\d{4}$/| Input | Match |
|:------|:-----:|
| 00020288020208260100 | ✅ |
| 0002028-80.2020.8.26.0100 | ❌ |
Last updated: 2026-04-09
municipalRegistration — ✅ '1234567890' — Matches a Brazilian Municipal Registration number with 6 to 15 digits (Enforces beginning and end of string)
/^\d{6,15}$/| Input | Match |
|:------|:-----:|
| 1234567890 | ✅ |
| 12345 | ❌ |
Last updated: 2026-04-09
suframa — ✅ '12.345.678/0001' — Matches a Brazilian SUFRAMA registration number in the format XX.XXX.XXX/XXXX (Enforces beginning and end of string)
/^\d{2}\.\d{3}\.\d{3}\/\d{4}$/| Input | Match |
|:------|:-----:|
| 12.345.678/0001 | ✅ |
| 12345678/0001 | ❌ |
Last updated: 2026-04-09
Countries / BR / Government / Inscricao-estadual
inscricaoEstadualAC — ✅ '01.234.567/890-12' — Matches an Acre (AC) Inscricao Estadual starting with 01 in the format 01.XXX.XXX/XXX-XX (Enforces beginning and end of string)
/^01\.?\d{3}\.?\d{3}\/?\d{3}-?\d{2}$/| Input | Match |
|:------|:-----:|
| 01.234.567/890-12 | ✅ |
| 02.234.567/890-12 | ❌ |
Last updated: 2026-04-09
inscricaoEstadualAL — ✅ '240123456' — Matches an Alagoas (AL) Inscricao Estadual starting with 24 followed by 0, 3, 5, 7, or 8 (Enforces beginning and end of string)
/^24[03578]\d{6}$/| Input | Match |
|:------|:-----:|
| 240123456 | ✅ |
| 241123456 | ❌ |
Last updated: 2026-04-09
inscricaoEstadualAM — ✅ '12.345.678-9' — Matches an Amazonas (AM) Inscricao Estadual in the format XX.XXX.XXX-X (Enforces beginning and end of string)
/^\d{2}\.?\d{3}\.?\d{3}-?\d$/| Input | Match |
|:------|:-----:|
| 12.345.678-9 | ✅ |
| 12.345.678-90 | ❌ |
Last updated: 2026-04-09
inscricaoEstadualAP — ✅ '031234567' — Matches an Amapa (AP) Inscricao Estadual starting with 03 followed by 7 digits (Enforces beginning and end of string)
/^03\d{7}$/| Input | Match |
|:------|:-----:|
| 031234567 | ✅ |
| 041234567 | ❌ |
Last updated: 2026-04-09
inscricaoEstadualBA9 — ✅ '1234567-89' — Matches a Bahia (BA) Inscricao Estadual with 9 digits in the format XXXXXXX-XX (Enforces beginning and end of string)
/^\d{7}-?\d{2}$/| Input | Match |
|:------|:-----:|
| 1234567-89 | ✅ |
| 123456-89 | ❌ |
Last updated: 2026-04-09
inscricaoEstadualBA8 — ✅ '123456-78' — Matches a Bahia (BA) Inscricao Estadual with 8 digits in the format XXXXXX-XX (Enforces beginning and end of string)
/^\d{6}-?\d{2}$/| Input | Match |
|:------|:-----:|
| 123456-78 | ✅ |
| 1234567-89 | ❌ |
Last updated: 2026-04-09
inscricaoEstadualCE — ✅ '12345678-9' — Matches a Ceara (CE) Inscricao Estadual in the format XXXXXXXX-X (Enforces beginning and end of string)
/^\d{8}-?\d$/| Input | Match |
|:------|:-----:|
| 12345678-9 | ✅ |
| 1234567-9 | ❌ |
Last updated: 2026-04-09
inscricaoEstadualDF — ✅ '12345678-90' — Matches a Distrito Federal (DF) Inscricao Estadual in the format XXXXXXXX-XX (Enforces beginning and end of string)
/^\d{8}-?\d{2}$/| Input | Match |
|:------|:-----:|
| 12345678-90 | ✅ |
| 1234567-90 | ❌ |
Last updated: 2026-04-09
inscricaoEstadualES — ✅ '123456789' — Matches an Espirito Santo (ES) Inscricao Estadual as 9 consecutive digits (Enforces beginning and end of string)
/^\d{9}$/| Input | Match |
|:------|:-----:|
| 123456789 | ✅ |
| 12345678 | ❌ |
Last updated: 2026-04-09
inscricaoEstadualGO — ✅ '12.345.678-9' — Matches a Goias (GO) Inscricao Estadual in the format XX.XXX.XXX-X (Enforces beginning and end of string)
/^\d{2}\.?\d{3}\.?\d{3}-?\d$/| Input | Match |
|:------|:-----:|
| 12.345.678-9 | ✅ |
| 12.345.678-90 | ❌ |
Last updated: 2026-04-09
inscricaoEstadualMA — ✅ '121234567' — Matches a Maranhao (MA) Inscricao Estadual starting with 12 followed by 7 digits (Enforces beginning and end of string)
/^12\d{7}$/| Input | Match |
|:------|:-----:|
| 121234567 | ✅ |
| 131234567 | ❌ |
Last updated: 2026-04-09
inscricaoEstadualMG — ✅ '123.456.789/0123' — Matches a Minas Gerais (MG) Inscricao Estadual in the format XXX.XXX.XXX/XXXX (Enforces beginning and end of string)
/^\d{3}\.?\d{3}\.?\d{3}\/?\d{4}$/| Input | Match |
|:------|:-----:|
| 123.456.789/0123 | ✅ |
| 123.456.789/012 | ❌ |
Last updated: 2026-04-09
inscricaoEstadualMS — ✅ '281234567' — Matches a Mato Grosso do Sul (MS) Inscricao Estadual starting with 28 followed by 7 digits (Enforces beginning and end of string)
/^28\d{7}$/| Input | Match |
|:------|:-----:|
| 281234567 | ✅ |
| 291234567 | ❌ |
Last updated: 2026-04-09
inscricaoEstadualMT — ✅ '1234567890-1' — Matches a Mato Grosso (MT) Inscricao Estadual in the format XXXXXXXXXX-X (Enforces beginning and end of string)
/^\d{10}-?\d$/| Input | Match |
|:------|:-----:|
| 1234567890-1 | ✅ |
| 123456789-1 | ❌ |
Last updated: 2026-04-09
inscricaoEstadualPA — ✅ '15123456-7' — Matches a Para (PA) Inscricao Estadual starting with 15 in the format 15XXXXXX-X (Enforces beginning and end of string)
/^15\d{6}-?\d$/| Input | Match |
|:------|:-----:|
| 15123456-7 | ✅ |
| 16123456-7 | ❌ |
Last updated: 2026-04-09
[inscricaoEstadualPE](./src/regexen/countries/br/government/inscricao-
