A regex tester lets you write and debug regular expressions against sample text in real time. Regular expressions (regex) are powerful pattern-matching sequences used in programming, data validation, and text processing. This free tool highlights matches instantly, shows captured groups, and supports find-and-replace with regex substitution.

Regular Expression

/ / g

Common Presets

Test String

0
Matches
0
Groups
0
String Length
0
Time (ms)

Replace Mode

Regex Quick Reference

Character Classes

.Any character (except newline)
\dDigit [0-9]
\DNot a digit
\wWord character [a-zA-Z0-9_]
\WNot a word character
\sWhitespace
\SNot whitespace
[abc]Character set (a, b, or c)
[^abc]Negated set (not a, b, or c)
[a-z]Range (a through z)

Quantifiers

*0 or more
+1 or more
?0 or 1
{n}Exactly n
{n,}n or more
{n,m}Between n and m
*?Lazy: 0 or more (fewest)
+?Lazy: 1 or more (fewest)

Anchors & Boundaries

^Start of string/line
$End of string/line
\bWord boundary
\BNot a word boundary

Groups & Lookaround

(abc)Capture group
(?:abc)Non-capture group
(?<name>abc)Named capture group
a|bAlternation (a or b)
(?=abc)Positive lookahead
(?!abc)Negative lookahead
(?<=abc)Positive lookbehind
(?<!abc)Negative lookbehind