Regex Tester

Test JavaScript regular expressions in real time. See matches, capture groups, and flags as you type. Pattern and text stay in your browser.

Runs in your browser — nothing uploaded
Pattern
gi
Test text
2 matches
Email hello@utilo.fun or admin@example.com to say hi.
Match details
#MatchIndexGroups
1hello@utilo.fun621
$1: hello
$2: utilo.fun
2admin@example.com2542
$1: admin
$2: example.com

Use this free regex tester to debug JavaScript regular expressions in real time. Edit the pattern, toggle flags, and see every match highlighted directly in your text — plus a table of capture groups and positions. It runs entirely in your browser, so pattern and data stay on your device.

Private by design — your data never leaves your device

How to use it

No account, no upload — it all happens on your device.

1
Type or paste a regex pattern in the top field. Slashes are added automatically.
2
Toggle flags (g, i, m, s, u, y) by clicking the chips — global is on by default.
3
Paste the test text below. Matches highlight live as you type.
4
Scroll the Match details table to inspect each match, its position, and any capture groups.

Quick reference: common patterns

Copy-paste recipes for everyday matching.

GoalPatternNotes
Match an integer^-?\d+$Optional leading minus; one or more digits.
Match an email (loose)[\w.+-]+@[\w-]+\.[\w.-]+Good enough for UI hints. For true validation, send a verification email.
Strip surrounding whitespace^\s+|\s+$Use with the global flag and replace with empty.
Capture a URL(https?)://([\w.-]+)(/\S*)?Groups: protocol, host, optional path.
ISO date\d{4}-\d{2}-\d{2}Won't reject 2024-13-99 — just checks shape.
Whole-word match\bword\b\b is a zero-width word boundary.

JavaScript regex vs PCRE — quick notes

Patterns that travel and patterns that don't.

  • Named groups. JS supports (?<name>…) since ES2018. Most modern flavors do too, but syntax differs in older PCRE.
  • Lookbehind. JS supports (?<=…) and (?<!…) since ES2018. Safari shipped it late — fine in 2024+.
  • Unicode property escapes. JS needs the u flag for \p{L}, \p{Emoji}, etc. Without u, \p is just a literal p.
  • Possessive quantifiers and atomic groups. PCRE has them; JavaScript does not. Workarounds: rewrite to remove ambiguity, or use lookahead tricks.
  • Recursion / subroutines. Not in JS regex. Parse with a real parser for nested structures like JSON.

Catastrophic backtracking

A regex engine that supports backtracking can take exponential time on certain patterns against certain inputs. The classic shape is nested ambiguous quantifiers like (a+)+ applied to a long string of as followed by a non-match. Each a doubles the work the engine does before failing.

Avoiding it:

  • Anchor your patterns. ^pattern$ rules out a lot of failed match starts.
  • Make alternatives mutually exclusive. (a|b)+ is fine; (a|aa)+ can blow up.
  • Replace nested quantifiers with a single quantifier on a character class when possible. [ab]+ instead of (a|b)+.
  • When the input is untrusted (user-submitted search terms, logs), cap input size or run regex matching with a timeout in a Worker.

Frequently asked

Which regex flavor does this use?
JavaScript regular expressions (ECMAScript) — the same flavor used by Node.js and every modern browser. Most basic patterns are portable across PCRE, Python, Ruby, and Java, but features like lookbehind, named groups, and Unicode property escapes have subtle differences.
Is my pattern or test text sent anywhere?
No. The regex is compiled and matched entirely in your browser using the built-in RegExp engine. Nothing about the pattern or the test text is uploaded.
Why does my pattern hang or feel slow?
Some patterns suffer from catastrophic backtracking — typically nested quantifiers like (a+)+ against long input. The tester caps match attempts to keep the page responsive, but the safest fix is to rewrite the pattern using atomic alternatives or possessive quantifiers (or in JS, restructure to avoid the ambiguity).

Related tools

JSON Formatter & BeautifierFormat, beautify, and validate JSON instantly in your browser. Your data never leaves your device.JWT Decoder & VerifierDecode and verify JSON Web Tokens (JWT) in your browser. HS256, RS256, ES256 supported. Tokens and keys never leave your device.Base64 Encoder & DecoderEncode text to Base64 or decode Base64 back to text instantly in your browser. Unicode-safe. Nothing is uploaded.