How to use Regex Tester
- Type your regular expression, without the slashes.
- Tick the flags you need: g, i, m, s, u or y.
- Paste your test text. Matches are highlighted and listed with their position and groups.
- Optionally type a replacement such as $1-$2 to preview the result of a replace.
Features
- Live highlighting of all matches
- Table of matches with position, numbered groups and named groups
- Flags g, i, m, s, u and y
- Replace preview with $1, $<name> and $&
- Patterns run in a Web Worker and are stopped after 2 seconds, so a slow pattern cannot freeze the page
Supported formats and limits
- Maximum input: 200,000 characters
Examples
| Input | Result |
|---|---|
| Pattern: (\w+)@(\w+)\.com Flags: g Text: ana@mail.com, luis@web.com | 2 matches: ana@mail.com (groups: ana, mail) and luis@web.com (groups: luis, web) |
| Pattern: (?<y>\d{4})-(?<m>\d{2}) Replacement: $<m>/$<y> Text: on 2026-09 and 2027-01 | on 09/2026 and 01/2027 |
Limitations
- It uses the JavaScript (ECMAScript) regular expression engine of your browser. Patterns written for PCRE, Python, .NET or Java can behave differently, for example in lookbehind support or in named group syntax.
- Test text is limited to 200,000 characters, and a pattern that runs longer than 2 seconds is stopped.
- Only the first 1,000 matches are stored and the first 100 are listed in the table, although the total count is exact.
Learn more
A regular expression is a compact pattern for finding and transforming text. Character classes such as \d and \w, quantifiers such as + and {2,4}, groups in parentheses and anchors such as ^ and $ can be combined to describe, for example, an email-like string or a date.
Capture groups are the parts in parentheses. They let you pull out pieces of a match, and named groups, written (?<name>…), make that more readable. In a replacement, $1 or $<name> inserts what a group matched.
Most regex engines, including JavaScript’s, use backtracking: they try alternatives one after another and return when a path fails. For most patterns that is fast, but a pattern with nested or overlapping repeats can try an enormous number of paths on an unlucky input and appear to hang. That is why this tester runs patterns in a separate worker with a time limit, and why it is wise to test a pattern on hostile input before using it on user-supplied text.
Frequently asked questions
What regex flavour does this use?
The JavaScript flavour of your browser. That is the one used by JavaScript and TypeScript code, so results match what your code will do.
What do the flags mean?
g finds all matches, i ignores case, m makes ^ and $ match at each line, s lets the dot match line breaks, u enables full Unicode matching and y matches only at the current position.
Why was my pattern stopped after 2 seconds?
Some patterns, such as nested repeats like (a+)+, take exponentially longer on certain inputs, which is called catastrophic backtracking. The tester stops them so the page keeps working. Simplify the pattern or test shorter text.
Is my text sent to a server?
No. The pattern and text are processed in your browser.
Sources
Last reviewed: September 30, 2026