What is the Regex Tester?
The Regex Tester runs JavaScript regular expressions against your sample text, highlighting every match and listing capture groups and named groups. You can toggle flags and preview the result of a replacement.
Patterns run inside a Web Worker with a two-second time limit, so a pattern with catastrophic backtracking is stopped safely instead of freezing your browser.
Who is the Regex Tester for?
- JavaScript and web developers writing validation or parsing patterns.
- Data analysts extracting values from text.
- Students learning regular expressions.
Key features
- Live highlighting of matches with all JavaScript flags.
- Table of match positions and capture groups, including named groups.
- Replacement preview using $1, $2 or $<name>.
Why use it?
Regular expressions are compact but easy to get wrong. Seeing matches highlighted live while you edit a pattern is the fastest way to build and debug one before putting it into code.
How to use the Regex Tester
- Type a pattern without the surrounding slashes.
- Tick the flags you need (g for all matches, i for case-insensitive, m for multi-line anchors, and so on).
- Paste test text; matches are highlighted automatically.
- Inspect the table of match positions and groups.
- Optionally tick “Test a replacement” and use $1, $2 or $<name> to reference groups.
Examples
Finding email-like strings
\b(\w+)@(\w+)\.com\b with flags gi finds alice@example.com and BOB@test.com, capturing the user and domain separately.
Reformatting dates
Pattern (\d{4})-(\d{2})-(\d{2}) with replacement $3/$2/$1 turns 2026-11-21 into 21/11/2026.
Supported formats and inputs
- JavaScript (ECMAScript) regular expression syntax, including lookbehind and named groups in modern browsers.
- Test text up to 1,000,000 characters; up to 5,000 matches listed.
Limitations to know about
- Syntax is JavaScript's. Some PCRE, Python or .NET features (possessive quantifiers, recursion, inline modifiers in older browsers) are not supported.
- Results reflect the regex engine of the browser you are using.
Privacy
Everything is processed by JavaScript running in your browser tab. Your input is not sent to a server, logged or stored, so it is safe to use with configuration files and internal data. As always, avoid pasting production secrets into any website you do not control.
Frequently asked questions
Why did my pattern time out?
Nested quantifiers such as (a+)+ can take exponential time on certain inputs. Make quantifiers more specific or use anchors.
Why do I only get one match?
Without the g (global) flag, JavaScript stops after the first match. Tick g to find all matches.
Which regex flavour does this tester use?
JavaScript (ECMAScript), exactly as implemented by your current browser. Patterns that work here will behave the same in JavaScript and TypeScript code, but may need small changes for Python, PHP (PCRE) or .NET.