BrowserTools

Regex Tester

Live pattern matching with highlights

By Guga — BrowserTools maintainer, Tbilisi, Georgia Updated 2026-09-21
Free Private No uploads
What is Regex Tester?

A pattern box, a flags box and a text area, with the results recomputed on every keystroke. The pattern goes straight to the browser's own RegExp constructor, so what you see is what String.prototype.match will do in production rather than a server-side dialect with different rules. Matches are highlighted in place in the rendered paragraph, and a table underneath lists each one with its index and every captured group, named captures included. Two implementation details matter in practice: the global flag is forced on whatever you type, so the table always enumerates every hit instead of stopping at the first; and collection is capped at 500 matches, so a greedy pattern against a large document fills the table rather than locking the page. Invalid syntax surfaces as the engine's own wording. A sixteen-token reference panel loads any entry into the pattern field on click.

Test regular expressions against sample text with live match highlighting, group capture tables and common pattern reference. Supports all JavaScript regex flags.

Private Regex Tester In Your Browser

Regex Tester is processed locally with client-side JavaScript. Your files never touch a server, and there is no queue to wait in.

Step-by-Step

How to use Regex Tester

1

Enter the expression in the Pattern field and the flags in the Flags field; gm is the starting point and g is always added for you.

2

Edit the Test text, or use the sample paragraph already loaded to try the expression immediately.

3

Read the highlighted output for matches in context, then the table below it for each match's index and captured groups.

4

Click any entry in the cheat sheet panel to load it into the pattern field, and copy the current pattern from its panel header.

Key Capabilities
  • Runs on the browser's native RegExp engine, so a pattern that behaves here behaves the same in client-side JavaScript.
  • The global flag is appended before the expression is built, so the results table enumerates every match rather than only the first.
  • Collection stops at 500 matches and zero-length matches step lastIndex forward, which removes the two ways a naive loop can hang.
  • Sixteen reference tokens load into the pattern field on click, and the pattern currently in use is one button from the clipboard.
Common Use Cases
  • A backend developer pastes a log excerpt and a candidate expression to see which lines match before adding it to a parser.
  • Someone learning regular expressions works through the token reference and watches what a lookbehind does against a real paragraph.
  • A developer debugging an extraction that returns the wrong substring reads the capture table to see which group is holding the value.
Clear Answers

Frequently Asked Questions

Does this protect me from a slow pattern?
Partly. The 500-match cap and the step past zero-length matches remove the two easy hangs. There is no worker with a timeout around the match, though, so a genuinely catastrophic expression such as (a+)+b against a long run of a's can still stall the tab. Test anything untrusted on sample text you control.
Why do I get every match when I never typed g?
The global flag is added before the expression is constructed, because a one-shot exec reports only the first hit and would make the capture table useless. The other flags are yours to set or clear.
How does this differ from a server-side regular expression?
Dialect. This is the JavaScript engine: lookbehind works, \d and \w cover ASCII only rather than every Unicode digit, and there is no possessive quantifier or atomic group. A pattern lifted from a Python or PCRE reference may behave differently here.
How do I match a character that is itself special?
Put a backslash in front of it, so a literal full stop in a version string is written \. and a plus in a phone number is \+. Inside a character class such as [.] the metacharacters lose their special meaning and need no escape.