What is a Regex Tester?
A regular expression is a pattern that describes a set of strings. A regex tester runs a pattern against sample text and shows what it matches, where each match starts and what each capture group contains β which turns guesswork into a result you can see.
This tester uses the JavaScript engine's own RegExp implementation, so what you see is exactly what `String.prototype.match` and `String.prototype.replace` will do. Flags are toggles rather than typed characters: g finds every match instead of the first, i ignores case, m makes ^ and $ match at each line break, s lets the dot span newlines, u enables Unicode mode with full code-point escapes, and y pins matching to the last index.
Matches are always collected globally for the highlight, so you see every occurrence even when g is off. The match table lists each hit with its index and its capture groups, and the replace box previews what String.prototype.replace would produce, including $1, $2 and $<name> backreferences for named groups.
How to test a regular expression
- Type the pattern without the surrounding slashes β for a literal dot, write \.
- Toggle the flags you need. g is on by default because almost every real task wants all matches.
- Paste your test text. Every match is highlighted as you type, and invalid patterns report the engine's own error message instead of failing silently.
- Check the match table for the index and capture groups. A group that shows (undefined) means that branch of the pattern did not participate in that match, which is a common source of bugs in code that assumes every group is a string.
- Optionally enter a replacement to preview the result. $1 inserts the first group, $& inserts the whole match and $<name> inserts a named group.
Regex Tester limits and rules
| Item | Limit |
|---|---|
| Engine | The browser's own ECMAScript RegExp β matches yours and Node's behaviour |
| Flags available | g, i, m, s, u, y β the v (Unicode sets) flag is not exposed here |
| Highlighting | Always global, whatever the g flag says |
| Match cap | 1,000 matches per run, to keep a runaway pattern off your main thread |
| Table rows | First 100 matches are listed; the highlight covers them all |
| Lookbehind | Supported β Node 8.3+ and every current browser |
| Regex dialects | JavaScript only. PCRE, RE2 and Python differences β conditional patterns, \A, atomic groups β are not emulated |
| Catastrophic backtracking | Nested quantifiers such as (a+)+ can still freeze the tab; no timeout is imposed |
When to use it
- Writing a validation pattern for an email, phone number, slug or postcode field, and checking the edge cases you can think of before it reaches production.
- Parsing structured text β log lines, CSV rows, semicolon-separated lists β and confirming that the capture groups hold the pieces you expect.
- Debugging a find-and-replace that is matching more than it should, usually a missing escape or an unanchored pattern.
- Learning regex incrementally against real text rather than abstract examples, with an immediate answer for every change.
- Verifying an extraction pattern lifted from Stack Overflow actually applies to your data rather than the sample the author had.
Is it private?
Everything runs inside your browser. Your text and files are never uploaded, never stored and never seen by anyone else β including me. You can use the tool with the network tab open and watch no request leave the page. Closing the tab erases the input.
Frequently asked questions
Yes. It calls the RegExp constructor of the page's own engine, which is V8 in Chrome and Node, SpiderMonkey in Firefox and JavaScriptCore in Safari. Behaviour is standardised and identical for everything except the newest additions such as the v flag.
Because in a JavaScript string literal a backslash is an escape character, so "\\d" is the two characters backslash and d. The pattern field here takes regex source directly, so you type \d. In code, either double the backslash inside a string or use a literal like /\d/g.
The g flag changes what the engine does when code calls exec repeatedly β it continues from lastIndex instead of resetting. Highlighting here always collects every match so the display stays useful, and the flag panel still shows what your code would do with the same pattern.
It can, and this tool does not prevent it: no timeout is imposed, because JavaScript cannot interrupt a running regex. Patterns with nested quantifiers such as (a+)+ against a long non-matching string can backtrack exponentially. Keep test text short while developing a risky pattern.
No. Both the pattern and the test text stay in the page and are compiled locally, so you can paste real log lines or production data without it leaving your machine.
Related tools
Written and maintained by Md. Nur Hossain Repon.