JoyToolsJoyTools

Regex Tester

100% Client-Side Private — Zero Server Uploads

Test regular expressions with live match highlighting, match details, and preset patterns.

🔒 100% Client-Side: All data is processed locally in your browser and never leaves your device (Zero Server Uploads).
E-E-A-T Security Proof →
Interactive Workspace
//
Quick Presets:
Matched 2 text segments
Execution time: 0.36ms
2 Matches Highlighting
Contact us at hello@joytools.dev#1 or support@company.org#2. Test string: aaa.
#IndexMatched TextLengthCapture Groups
114hello@joytools.dev18None
236support@company.org19None
Share & Developer Embed

How do I use Regex Tester?

1

Enter your regular expression pattern and toggle flags (`g`, `i`, `m`, `s`, `u`), or click a Quick Pattern preset.

2

Paste your test string into the Test String editor to view real-time highlighted matches and capture groups.

3

Inspect the Match Details list (indices and `$1`, `$2` groups) or switch to Find & Replace mode.

What features does Regex Tester offer?

Real-time regex match highlighting & capture group index table

Support for flags (g, i, m, s, u, y)

Common developer pattern presets (Email, URL, IP, Date)

100% client-side JavaScript RegExp evaluation

ECMAScript `RegExp` Flags, Quantifiers & Catastrophic Backtracking (ReDoS)

This tester executes native V8/SpiderMonkey ECMAScript `RegExp` syntax directly in your browser, supporting named capture groups (`(?<name>...)`), lookaheads (`(?=...)`), and lookbehinds (`(?<=...)`).

JavaScript RegExp Flags & Engine Behavior Matrix
FlagNameEngine Behavior ModificationCommon Pitfall Without Flag
gGlobalFinds all matches rather than stopping after index 0.match() returns only the first occurrence
iIgnore CaseCase-insensitive matching ([a-z] matches A-Z)Fails on uppercase email/URL characters
mMultiline^ and $ match start/end of each line (\n) instead of whole string^ only matches index 0 of multi-line log
s / uDotAll / Unicode. matches \n (s); enables surrogate-pair & \p{...} matching (u). stops at line breaks; emojis split in half

Frequently Asked Questions about Regex Tester

What is Catastrophic Backtracking (ReDoS) and why do nested quantifiers like `(a+)+$` freeze regex engines?

NFA regex engines evaluate ambiguous nested quantifiers like `(a+)+$` or `([a-zA-Z]+)*` in $O(2^n)$ exponential time when a string fails to match at the final character. Flatten nested quantifiers to `a+$` or use possessive/atomic patterns to keep matching linear.

Why does `^` or `$` only match the very start and end of my multi-line text?

By default, `^` and `$` anchor to the beginning and end of the entire string buffer. Enable the `m` (Multiline) flag so `^` and `$` match immediately after and before every `\n` line break.

How do I change a greedy quantifier (`.*`) into a lazy (non-greedy) quantifier (`.*?`)?

Append a question mark `?` after any quantifier (`*?`, `+?`, `??`, `{n,m}?`). For example, `/<.+>/` greedily matches from the first `<` to the very last `>` on a line, whereas `/<.+?>/` stops at the first closing `>`.

Why do I need the `u` (Unicode) flag when matching emojis or `p{L}` character classes?

Without the `u` flag, JavaScript `RegExp` treats 4-byte UTF-16 astral symbols (like emojis) as two separate 2-byte surrogate code units and does not recognize Unicode property escapes like `\p{L}` or `\p{Emoji}`.