Enter a pattern and test string to see matches highlighted — everything runs locally in your browser, with nothing uploaded.
📖 Regex cheatsheet
How it works
- Uses your browser's native
RegExpengine — the same one your JavaScript code would use. - Common flags:
g(global, find all matches),i(case-insensitive),m(multiline),s(dot matches newline). - Invalid patterns show an error instead of a crash.
About the regular expression tester
A regular expression (regex) is a compact pattern for finding, checking or extracting text — email addresses in a document, dates in a log file, or anything that follows a rule. This tester lets you write a pattern and see instantly which parts of your sample text it matches, so you can refine it without running code.
It runs entirely in your browser using the same RegExp engine JavaScript uses, so what you see here is exactly what your code will do. Nothing you paste is uploaded or stored.
Common uses
- Validating input like emails, phone numbers or postcodes before saving them.
- Extracting fields from log lines, CSVs or scraped text.
- Search-and-replace across a large block of text using capture groups.
- Learning or teaching regex, where seeing matches highlighted makes the rules click.
Use it carefully
Regex is powerful but easy to get subtly wrong. A pattern that looks right can miss edge cases (an email with a + in it, a name with an apostrophe) or match more than you intend. Test against realistic samples — including the awkward ones — before relying on a pattern in production, and never use regex alone to validate security-sensitive input.
Understanding your results
Matches are highlighted directly in your sample text, and listed below it with their position — so you can see not just whether the pattern matches, but exactly what it captured. Capture groups are shown separately.
If nothing matches, the list is simply empty. That's usually a flag issue (missing the global flag, or a case mismatch) rather than a broken pattern — the tool shows an error only when the pattern itself is invalid.
What regex flavour does this use?
JavaScript's built-in engine (ECMAScript). It's very close to PCRE for everyday patterns, but a few advanced features differ — lookbehind support depends on your browser version, for example.
Is my text sent anywhere?
No. Matching happens in your browser; nothing you type in the pattern or the test text leaves your device.
Why does my pattern match nothing?
Check your flags first — without the g flag only the first match is found, and case matters unless you add i. An invalid pattern shows an error rather than failing silently.
Related guide: Write regular expressions you can trust →
Regular expressions began as a mathematical idea
The roots of regular expressions are tied to formal-language work by mathematician Stephen Kleene in the 1950s. The notation later became practical in text-processing tools and programming languages.
Tiny symbols can describe huge sets of strings
A pattern such as [0-9]+ describes not one string but an entire class of strings containing one or more digits. That compactness is what makes regex both powerful and easy to misuse.