Regex tester

Enter a pattern and some text: every match is highlighted and its capture groups listed as you type.

Flags

FlagEffect
gFind all matches, not just the first
iCase-insensitive
m^ and $ match at line breaks
s. also matches newlines
uUnicode mode (code points, \p{…})
ySticky: match only at lastIndex
dRecord match indices

Useful patterns

PurposePattern
Integer^-?\d+$
Decimal number^-?\d+(\.\d+)?$
Hex color^#?([0-9a-f]{3}|[0-9a-f]{6})$ (i)
ISO date^\d{4}-\d{2}-\d{2}$
IPv4 (loose)^(\d{1,3}\.){3}\d{1,3}$
Slug^[a-z0-9]+(-[a-z0-9]+)*$
Whitespace runs\s+

More syntax in the regex cheat sheet.

This tester uses your browser's JavaScript engine. PCRE (PHP), Python re and Java differ in details such as lookbehind support and named-group syntax.

Frequently asked questions

Why does my regex match an empty string forever?
Patterns like a* can match zero characters. The tester advances past empty matches automatically; your own loop must do the same.
How do I match a literal dot?
Escape it: \.. An unescaped dot matches any character except a newline.