Regex Tester

Test JavaScript regular expressions with live match highlighting.

//ig
Contact alice@example.com or bob@test.org for details.

Match details

#1 @ 8: alice@example.com
Groups: $1="alice"$2="example.com"
#2 @ 29: bob@test.org
Groups: $1="bob"$2="test.org"

Cheatsheet — click to load

Contact
Web
Network
IDs
Dates & Numbers
Code

About Regex Tester

Regex Tester runs a JavaScript regular expression against a sample string and highlights every match in the input as you type. Capture groups and named groups are listed below the highlight, with their start and end indices for the first match. Toggle the standard flags — `g`, `i`, `m`, `s`, `u`, `y`, `d` — to change matching behaviour without retyping the pattern.

Reach for it whenever you are crafting or debugging a regex: validating a pattern before pasting it into source code, decoding why a regex is matching too much or too little, exploring what a complex character class actually accepts, or spelunking through edge cases (empty matches, lookbehind quirks, Unicode categories). Regex Tester is for *building* the pattern; once you have a working one, use Filter Lines by Regex to apply it as a filter across many lines, or paste it into the case-conversion / find-replace tools that consume regex.

Examples

Input
pattern: (\d{4})-(\d{2})-(\d{2})
flags: g
input: orders 2024-01-15 and 2024-12-31
Output
matches: 2024-01-15, 2024-12-31
group 1: 2024 / 2024
group 2: 01 / 12
group 3: 15 / 31

Two ISO dates matched; capture groups extracted for each. Live highlight in the input box updates per keystroke.

Frequently asked questions

What regex flavour is supported?

JavaScript regex (the same flavour `RegExp` provides in any browser). That includes lookbehind (`(?<=…)`, `(?<!…)`), named groups (`(?<name>…)`), and Unicode property escapes (`\p{Letter}` with the `u` flag). Most patterns from grep, sed, or PCRE translate directly; a few PCRE-specific features like recursion and possessive quantifiers do not.

How is this different from Filter Lines by Regex?

Regex Tester is for crafting and debugging the pattern: it shows matches, capture groups, and indices. Filter Lines by Regex applies a pattern across many lines and keeps or drops matches. Build the pattern here; apply it there.

Why does the global flag affect the match list?

Without the `g` flag, regex engines stop after the first match. With `g`, every non-overlapping match is returned. Toggle it on if you want to see all matches in a long input; off if you are only interested in the first.

What does the `d` flag do?

It enables match indices, so capture groups report not just their captured text but the start and end position of each capture. Useful when you want to substring the input around a match without re-running the regex.