Skip to main content
Direct WebTools

Regex Tester Online

Test and replace JavaScript regular expressions online in real time with flags, named groups, a matches table and a cheatsheet, right in your browser.

/
Result

            

        

Matches

# Match Numbered groups Named groups Index

Examples

Click any row to load the pattern, test string, flags and options into the form, then press Process. The Result column shows exactly what the tool outputs for each example.

Pattern Test string Result
/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/gi Contact [email protected] or [email protected]. [email protected] · [email protected]
/(\w+)-(\d+)/g item-42, code-7, part-100 item-42 (item, 42) · code-7 (code, 7) · part-100 (part, 100)
/hello/gi Hello world, HELLO again, hello! Hello · HELLO · hello
/(\d{4})-(\d{2})-(\d{2})/g → $3-$2-$1 Due 2026-12-25 and 2027-01-01 Due 25-12-2026 and 01-01-2027
/\d{5}/g Order A-123 and B-9876 (no match)

Frequently asked questions

Do I need to wrap the pattern in slashes?

No. Enter only the expression; select the flags with the chips below the pattern field, and the tester builds /pattern/flags internally.

What does each flag do?

g returns all matches instead of only the first, i ignores letter case, m makes ^ and $ match line boundaries, s lets . match newlines, u enables unicode handling and y anchors the search at lastIndex (sticky).

How do capture groups work in the Replacement field?

Parentheses capture parts of each match; reuse them with $1, $2… (named groups use $), and the matches table lists every captured group.

Quick reference

Character classes

.
Any character
\d
Digit [0-9]
\w
Word character [a-zA-Z0-9_]
\s
Whitespace

Quantifiers

*
Zero or more
+
One or more
?
Zero or one
{n,m}
Between n and m

Anchors

^
Start of string
$
End of string
\b
Word boundary

Groups

(...)
Capture group
[...]
Character class
|
Alternation (or)
(?:...)
Non-capturing group

Escapes

\.
Literal dot
\\
Literal backslash

Flags

g
Global — all matches
i
Ignore case
m
Multiline — ^ and $ per line