Test any JavaScript regex live
Type a pattern, toggle flags and watch matches highlight inside your sample text. Inspect every capture group and named group. Runs entirely in your browser.
How to test a regex
Paste your pattern, toggle the flags you need, drop in some sample text — matches highlight live.
- 01
Paste pattern
Type or paste a regex into the pattern field — the
/pattern/flagswrapper above mirrors what JavaScript actually executes. Validation runs as you type; an invalid pattern surfaces a precise syntax error inline.Patterns compile through the native ECMAScript
RegExpconstructor, so Unicode property escapes (\p{L}), named groups ((?<name>...)), and lookbehind all work — provided theuflag is on for property escapes.ECMAScriptRegExpUnicode escapesnamed groupsliteralinput · patternECMAScript · live\b\w+@\w+\.\w+\b
21 chars · 1 lineECMA-262 compatible - 02
Pick flags
Toggle the seven ECMAScript flag characters individually. Each changes one semantic:
genables iteration withmatchAll,ifolds case,manchors per-line,slets.cross newlines,uunlocks proper Unicode,yis sticky, anddemits match indices.Combinations are non-trivial —
giis by far the most common, butgimsuon a multiline log line behaves very differently fromgmalone. For a deep dive open the Flag Tester.g flagi flagm flags · u · y · dmatchAllconfig · flag setg · global iteration/pattern/gi
2 flags on · liveECMA-262 § 21.2 - 03
Drop sample text
Paste sample text into the bottom field — every match highlights live, and the output panel lists positions, numbered capture groups, and named groups for each hit.
Watch for catastrophic backtracking on nested quantifiers like
(a+)+$— a classic ReDoS source. Matches are capped at 100,000 to keep the page responsive on pathological inputs; suspect patterns can be vetted in the ReDoS Detector.capture groupsnamed groupshighlightReDoS-safepositionsrun · highlighted matches3 hits · 0 groupsalice@x.com bob@y.io
20 B · 1 linelive · capped at 100k - 04
Copy or export
Copy a structured summary of every match — index, text, and capture groups — to your clipboard in one click, or download the report as a file for diffing against expectations.
Clipboard writes go through
navigator.clipboard.writeText; downloads use a localBloband object URL, so nothing transits the network. Open DevTools to Network to confirm.clipboardblobexportreportprivacy-firstexport · clipboardmatch reportCopied
ready to ship0 outbound
Regex patterns that don't melt down
Use named groups
(?<year>\d{4}) reads better than $1 and survives reordering. Supported in ECMAScript 2018+.
Anchor strictly
Use ^/$ with the m flag when matching whole lines. Without anchors, partial matches sneak through.
Avoid catastrophic backtracking
Nested quantifiers like (a+)+ can explode. Run patterns through ReDoS Detector first.
Escape every literal
Backslash any meta character you want literally: \.\$\^\*\+\?\(\)\[\]\{\}\|\\.
Test edge cases
Empty string, single character, unicode, the maximum length you expect — write fixtures for each.
Patterns aren’t parsers
Don’t parse HTML, JSON, or balanced parens with regex. Use a proper parser when the grammar is recursive.
When to reach for the tester
Authoring, debugging, validating regex on the fly.
Author a pattern
Iterate on a regex against realistic sample text. Compiles through the JavaScript RegExp constructor — engine quirks (Unicode property escapes, sticky matching, named groups) work when their flags are on. Error messages cite the exact position of any syntax issue.
ReDoS-safeDebug failures
See exactly what your regex does and does not match. Pairs with the ReDoS detector to catch catastrophic backtracking before you deploy. A pattern that handles 1k-character input fine can become a denial-of-service vector on attacker-controlled 1M-character input.
ECMA-compliantInspect groups
Read out every numbered and named capture. Output exports as JavaScript, Python re, Java util.regex, .NET System.Text.RegularExpressions, PCRE, and POSIX — language quirks are highlighted on conversion so you don't ship a JS-only pattern to a Go service.
spec-gradeCompare flags
Toggle ignoreCase, dotAll, multiline to see the impact. Capture groups (named or numbered) round-trip cleanly into replacement strings, JSON output, or CSV extraction without re-typing. Backreferences ($1, ${name}) preserve semantics across languages.
cross-engineTry ideas fast
No editor, no installs — just paste and try. Test against edge cases — empty input, single character, max length, multibyte boundaries — to catch off-by-one and zero-length match bugs before they reach production.
test-readyShare findings
Copy the match summary to chat or a ticket. All matching runs client-side so secret patterns never leave the browser. Useful when the pattern itself is sensitive (PII regexes, internal data formats, security filters).
production-readyFrequently asked questions
Something missing?
Tell us what you need. We ship the top requests every two weeks.