Regular Expression (RegEx) Tester
Test a regular expression against sample text and see the matches highlighted as you type. Pattern and flags are evaluated with the browser's own JavaScript regular expression engine, so what you see here is exactly what your JavaScript code will do.
How it works
- 1
Enter the pattern you want to test, without the surrounding slashes.
- 2
Set the flags β g for all matches, i for case-insensitive, m for multiline anchors.
- 3
Paste the text you want to match against.
- 4
Read the matches; an invalid pattern reports its error instead of silently matching nothing.
What people use it for
- Building a validation pattern for an email, phone number or postcode field.
- Working out a search-and-replace pattern before running it across a codebase.
- Extracting fields from log lines or a scraped block of text.
- Debugging why an existing pattern matches too much or too little.
Supported formats & options
| Dialect | JavaScript regular expressions (ECMAScript), as implemented by your browser |
|---|---|
| Flags | g (global), i (ignore case), m (multiline), s, u and y where the browser supports them |
| Test input | Any plain text, including multi-line content |
Key advantages & benefits
The same engine as your code
Matching uses the browser's native RegExp, so behaviour matches JavaScript exactly rather than approximating another dialect.
Instant iteration
Pattern, flags and test text all update live, which turns regex debugging into a fast feedback loop.
Clear error reporting
A malformed pattern surfaces the engine's own error message instead of failing silently.
Nothing leaves the tab
Test data β including logs or records you are matching against β stays on your device.
Limits & things to know
- JavaScript regex is not PCRE. Lookbehind support varies by browser, and features from Perl, Python or Java syntax may not exist here.
- Catastrophic backtracking is real: nested quantifiers against long input can hang the tab. Simplify the pattern rather than waiting it out.
- This tool shows matches; it does not perform a replacement across files.
Troubleshooting
Only the first match is highlighted
Add the g flag. Without it, the engine stops at the first match by design.
The pattern works elsewhere but not here
Check for dialect differences β \\d and \\w behave the same, but named groups, lookbehind and POSIX classes vary. Rewrite in ECMAScript syntax.
The page freezes on a long input
That is backtracking. Replace nested quantifiers such as (a+)+ with a single quantifier, and anchor the pattern where possible.
Privacy & data handling
The pattern and the test text are evaluated by your browser's regex engine in the page. Neither is sent to our server, so testing against real log lines or records is safe.
Online Regex Tester β Test & Debug Regular Expressions Live
Build and debug regular expressions against real sample text and watch every match highlight as you type. This online regex tester uses the browser's native JavaScript regex engine, so what matches here is exactly what will match in your application code.
- Live match highlighting β every match and capture group is highlighted in your test string the moment the pattern changes β no run button, no round trip.
- Full flag support β toggle global, case-insensitive, multiline and dotAll flags to see precisely how each one changes the result set.
- Capture groups made visible β numbered and named groups are listed per match, which is the fastest way to confirm an extraction pattern before wiring it into code.
- Test regex for validation rules β email formats, phone numbers, slugs, log lines and CSV fields β paste realistic sample data and prove the pattern before it reaches production.
- JavaScript-accurate results β because it runs on the same engine as your browser and Node, there is no dialect mismatch between the tester and your codebase.
Free, unlimited and account-free. Pair it with the Text Diff tool when you need to compare the before and after of a bulk regex replacement.
Frequently asked questions
What JavaScript regex engine is used?
It uses native browser JavaScript RegExp execution for 100% spec accuracy.
Does this match the regex flavour my language uses?
It matches JavaScript's. If you are writing Python, PHP, Java or Go, the basics behave identically but lookbehind, named groups and POSIX classes differ. Test in the target language for anything beyond common patterns.
Why does my pattern only find the first match?
The g flag is missing. Without it, the engine stops at the first match by design.
Why did the page freeze on a long input?
Catastrophic backtracking. Nested quantifiers such as (a+)+ can take exponential time on certain inputs. Simplify the pattern and anchor it where possible rather than waiting for it to finish.
Related tools
JSON Formatter
Format, validate and minify JSON instantly
Base64 Encoder & Decoder
Encode text or images to Base64 and decode back
HTML Entity Encoder & Decoder
Encode special characters to HTML entities and back
UUID / GUID Generator (v4)
Generate random, unique UUID v4 strings instantly