Regular expressions are powerful and famously unreadable. This regex tester makes them visible: type a pattern, paste your text, and every match lights up as you type, with its position and capture groups listed underneath. A plain-English cheat sheet sits under the tester for the moment you forget whether it is \d or \w.
It uses the JavaScript regex engine — the same one your browser and Node.js run — and everything happens locally. Paste log excerpts, config files or test data without worrying about where they go: they go nowhere.
How to read a regex without fear
A regular expression is a little program that describes a shape of text. It reads left to right, one element at a time: literal characters match themselves, and a small set of symbols change the meaning. \d means “a digit”, + after it means “one or more of those”, so \d+ reads as “one or more digits” — a whole number. Most patterns you will ever write are combinations of about a dozen such building blocks, and they are all in the cheat sheet under the tester.
A worked example
The tester opens with the pattern [A-Z][a-z]+ over a sentence containing an order number, a name, a date, an email and a phone number. It highlights Order, Ana and Contact — a capital letter followed by lowercase letters. Now try \b\d{4}-\d{2}-\d{2}\b: only the date lights up, because {4}, {2} pin the exact digit counts of a year-month-day shape. Swap in [\w.]+@[\w.]+ and the email address is the match. Building a pattern by tightening it, one element at a time, while the highlights update is the fastest way to learn — and to debug.
The flags, decoded
g (global) finds every match instead of stopping at the first; the tester defaults to it. i makes matching case-insensitive, so error also finds ERROR. m lets ^ and $ match at line starts and ends, not just the whole text — essential for logs. s lets the dot match newlines too, which matters when the thing you are hunting spans lines.
Capture groups: the part people actually need
Parentheses do two jobs: they group, and they remember. In (\w+)@(\w+) run over an email address, group 1 holds the part before the @ and group 2 the part after — the tester shows them in the Groups column. That memory is what turns a finder into an extractor: log parsers, CSV cleaners and rename scripts are mostly one good pattern plus its groups. If you only need the grouping without the memory, write (?:...).
Honest warnings
Regex dialects differ: this is the JavaScript flavour, so features like lookbehind work here but not in every tool, and POSIX tools (grep, sed) speak a different dialect again. Some patterns are catastrophically slow on near-matching text — nested quantifiers like (a+)+ are the classic trap — and a pattern that validates email addresses “perfectly” per the full RFC is a small essay; in practice a simple shape check plus a confirmation email wins. Finally: never use a regex to parse full HTML. Tags nest, and regexes do not nest with them; use a real parser.
Frequently asked questions
Why does my pattern match nothing?
Usually an unescaped special character: a literal dot needs \., a literal plus needs \+. Second most common: the g flag is off in the code you copied the pattern into, so only the first match is found.
What does the index column mean?
The character position where the match starts, counting from 0 at the first character of your text. It is the same index JavaScript’s exec() reports, which is what you need when extracting substrings in code.
How do I match something optional?
Put ? after it: colou?r matches both “color” and “colour”. The same symbol after a quantifier (*?, +?) makes it lazy — it then matches as little as possible instead of as much as possible.
Is my test text uploaded?
No. The tester runs on the JavaScript engine in your browser tab. Close the tab and the text is gone.
Related tools
Versión en español: Generador de Expresiones Regulares Regex Explicadas en Español: Crea, Prueba y Entiende Cada Patrón Paso a Paso. You may also like: DNS Record Checker — Look Up A, AAAA, MX, TXT, CNAME and NS Records · User-Agent Parser — Read Any User Agent String Online.
Embed this tool on your website — free
Copy the code below to add this working tool to your own page. A small credit link stays with it — that’s all we ask.
