Skip to content
Spellkit

Regex Tester

Test regular expressions live with match highlighting and capture groups.

//g
Examples:
Cheat sheet

Click a token to add it to your pattern.

Runs locally — your pattern and text never leave this browser.

What is Regex Tester?

Regex Tester is a free tool to test regular expressions online against your own text, with every match highlighted live as you type. It runs your browser's native JavaScript RegExp engine, so results match exactly what RegExp will do in your code — including capture groups, named groups, and the i, g, m, s, u, y flags.

Key features

  • Live match highlighting as you type
  • Capture groups and named groups listed per match
  • All six flags — i, g, m, s, u, y — with tooltips
  • Native JavaScript RegExp engine, same behavior as your code
  • Clear error messages for invalid patterns

Regex Tester — test regular expressions live

Writing a regular expression is a guessing game until you can watch it hit real text. This tester highlights every match live as you type, using your browser's own JavaScript RegExp engine — so what you see here is exactly what the same pattern will do in your JavaScript or TypeScript code, not an approximation from some other language's regex dialect.

The flags

Toggle the six standard flags; each is combinable and shown in the /pattern/flags display:

  • g — global: find every match, not just the first. It's on by default.
  • i — ignore case, so Cat matches cat and CAT.
  • m — multiline: ^ and $ match at the start and end of each line, not just the whole string.
  • s — dotall: . also matches newline characters.
  • u — unicode mode, needed for \u{...} escapes and correct handling of characters outside the basic plane, like many emoji.
  • y — sticky: match only starting at the current position.

The match list always enumerates all matches even if you leave g off, so you can inspect each one and its groups regardless.

Matches and capture groups

Each match is highlighted inline in your test text and listed below. For every match you also get its capture groups in order, and named groups like (?<year>\d{4}) are captured too — the panel shows an empty marker for a group that participated but captured nothing. An invalid pattern doesn't fail silently; you get a clear error message (for example, an unterminated group or a bad quantifier) so you can fix it immediately.

To get moving fast, the built-in examples load a working pattern and matching sample text in one click — email addresses, URLs, IPv4 addresses, hex colors, and ISO dates — and the cheat-sheet tokens (\d, \w, \b, +, [ ], and so on) append straight into your pattern.

Watch out for these

  • This is JavaScript regex, not PCRE. Patterns that work in Python, PHP, Java, or grep can behave differently or throw here. JavaScript uses (?<name>...) for named groups, has no \A/\Z anchors, and only supports possessive quantifiers and some lookbehind in modern engines.
  • \d and \w are ASCII by default. \d matches 0-9 only, and \w is [A-Za-z0-9_] — they do not match Arabic-Indic digits or accented letters unless you design for it. Add the u flag and Unicode property escapes like \p{L} for full coverage.
  • A greedy .* grabs too much. <.*> on <a><b> matches the whole thing, not each tag. Use a lazy .*? or a negated set like [^>]* to stop at the first boundary.
  • Escape literal special characters. To match a literal dot or question mark, write \. or \? — bare . and ? are operators.

Privacy and safety

Your pattern and test text run entirely in your browser — nothing is uploaded. Because evaluation uses the native engine it's effectively instant, and a safety valve stops after 10,000 matches so a pattern that matches an enormous number of positions can't freeze the page. Both the pattern and the text stay on your device.

Frequently asked questions

Which regex flavor does this use?
Your browser's native JavaScript RegExp engine, so results match exactly what the same pattern does in your JS or TypeScript code. Patterns written for Python, PHP, Java, or grep can behave differently; for example named groups use the (?<name>...) syntax and there are no \A or \Z anchors.
Do \d and \w match accented letters or non-Latin digits?
Not by default. \d is 0-9 and \w is [A-Za-z0-9_], both ASCII-only, so they skip accented letters and non-Latin digits. Add the u flag and Unicode property escapes like \p{L} for full Unicode coverage.
What do the six flags do?
g finds all matches (on by default), i ignores case, m makes ^ and $ match per line, s lets the dot match newlines, u enables Unicode mode, and y is sticky (matching only at the current position). They combine freely and show in the /pattern/flags display.
Why does my .* match more than I expected?
The .* quantifier is greedy and grabs as much as it can, so <.*> on <a><b> matches the whole string rather than one tag. Use a lazy .*? or a negated set like [^>]* to stop at the first boundary.
Can a bad pattern freeze the page?
A safety valve stops after 10,000 matches, so a pattern that matches an enormous number of positions will not hang the tab. Invalid patterns show a clear error instead of failing silently, and everything runs locally so the pattern and text are never uploaded.

Privacy

Your browser's own RegExp engine runs the match locally; neither the pattern nor the text you test against ever leaves your device.