Regex Explainer & Pattern Library.
Explain a regular expression token by token in plain English, or pick a tested pattern from the library.
Runs in your browserAbout Regex Explainer & Pattern Library
Regex Explainer breaks a regular expression into its parts and says what each one does, in order and with nesting. Paste ^(?<year>\d{4})-(0[1-9]|1[0-2]) and you get one row per token: start of the string, a capturing group named year that holds a digit exactly four times, the character "-", and a second group that is either 0 followed by 1-9 or 1 followed by 0-2. Quantifiers are spelled out, including whether they are greedy or lazy, so the difference between .* and .*? is obvious; character classes list their ranges; lookaheads, lookbehinds, named groups, back-references, Unicode property escapes and the active flags are all named. The syntax is JavaScript's, which is also what most editors, linters and browsers use, and the pattern is compiled by the real engine first, so a syntax error is reported instead of being explained. You can paste a pattern with or without slashes, as /a.c/gi or a.c. Add test text to see every match with its position and capture groups; as in JavaScript, only the first match is listed unless the g flag is set. The pattern library has ready-made, tested expressions for email addresses (the HTML5 definition), URLs, domains, IPv4, MAC addresses, UUIDs, semantic versions, ISO dates, times, hex colors, slugs, E.164 phone numbers and more, each with a note about what it does not check, for example that the ISO date pattern accepts February 31. Everything runs in your browser.
How to Use
- Paste a regular expression or choose one from the library.
- Add flags and, optionally, text to test against.
- Read the explanation row by row and check the matches table.
Frequently Asked Questions
Which regex flavor does it use?
JavaScript (ECMAScript). PCRE, Python and Go share most of the syntax, but features like possessive quantifiers or inline flags are not supported and will be reported as errors.
Why do I only see one match?
Without the g flag a JavaScript regex stops after the first match. Add g to the flags to list all matches.
Are the library patterns perfect validators?
No regex is. Each entry notes its limits; for example the email pattern follows the HTML5 rules and the date pattern does not check the number of days in a month.
Is my text sent anywhere?
No. The pattern is explained and executed in your browser, and the page makes no network requests while you use it.
Related Tools
Test regular expressions with match highlighting.
Test glob patterns like src/**/*.{ts,tsx} and !**/*.test.ts against a list of file paths.
Escape and unescape strings for different formats.
Convert text between case formats.
Count characters, words, sentences, and more.
Pretty print, minify, and validate JSON.