About this tool
A regex tester shows how a JavaScript regular expression matches sample text as you edit it. Enter an ECMAScript pattern, enable any of the g, i, m, s, u, or y flags, and inspect highlighted matches and capture groups. Replacement previews support numbered references such as $1 and named references such as $<name>.
Patterns and test text stay in your browser, are never uploaded, and are cleared when the tab closes. Matching runs in a background worker with a time limit, so a slow expression cannot lock the page. Common pattern presets and a syntax cheat sheet help you check unfamiliar tokens without leaving the tester.
How to use the Regex Tester
- 1Enter an ECMAScript pattern without surrounding slash characters.
- 2Add sample text and enable the flags your match requires.
- 3Inspect live highlights plus numbered and named capture group values.
- 4Type a replacement using $1 or $<name> and review its preview.
- 5Consult a preset or the cheat sheet when adjusting pattern syntax.
Features
Live match highlighting
See each current match marked directly in the supplied test text.
Named capture inspection
Review ordinary numbered groups and ECMAScript groups created with a name.
Replacement result preview
Test replacement strings containing $1 or $<name> before using them in code.
Timed worker execution
Run patterns away from the interface with a limit that stops very slow matching.
Flags presets reference
Combine six JavaScript flags with common examples and an included regex cheat sheet.
Frequently asked questions
Which regular expression flavor does this tester use?
It uses JavaScript's ECMAScript regular expression behavior. Patterns from other engines may use syntax or features that JavaScript handles differently.
How do I inspect a named capture group?
Create one with ECMAScript named-group syntax, then check the capture display. In replacement text, refer to it with $<name>.
Can a catastrophic regex freeze the page?
The pattern runs in a background worker and has a time limit. A very slow match is stopped rather than blocking the main page indefinitely.
What do the g and i regex flags do?
The g flag finds repeated matches instead of stopping after the first. The i flag performs case-insensitive matching.
Are my test strings uploaded during matching?
No. The expression and test data remain on your device and are not retained when the tab closes.