Regex Tester

Test, debug, and generate code for regular expressions in real-time.

/
/gu

No matches found
Language:
const regex = //gu;
const text = "";

// Test if matches
const hasMatch = regex.test(text);

// Find all matches
const matches = text.matchAll(regex);

// Replace
const replaced = text.replace(regex, 'replacement');

Character Classes

.
\w
\W
\d
\D
\s
\S
[abc]
[^abc]
[a-z]

Anchors

^
$
\b
\B

Quantifiers

*
+
?
*?
+?
{n}
{n,}
{n,m}

Groups & Lookaround

(abc)
(?<name>abc)
(?:abc)
(?=abc)
(?!abc)
(?<=abc)
(?<!abc)
\1

Special Characters

\n
\t
\r
\.
\\
|

Regex Flags Reference

g
Global

Find all matches rather than stopping after the first match

i
Case Insensitive

Match both uppercase and lowercase letters

m
Multiline

^ and $ match start/end of each line, not just the string

s
Dot All

Allows . to match newline characters

u
Unicode

Treat pattern and string as Unicode sequences

y
Sticky

Match only from the lastIndex position