Regex Tester
Write a regular expression and watch it match, live. Groups, positions and flags included.
Pattern
/gSamples
Test string
0 chars0 matches
Matches
Write a pattern to see matches.
Reference
Character classes
.- any character except newline
\d- digit (0–9)
\w- word character (a–z, A–Z, 0–9, _)
\s- whitespace (space, tab, newline)
[abc]- any one of a, b or c
[^abc]- anything except a, b or c
Quantifiers
*- 0 or more
+- 1 or more
?- 0 or 1
{3}- exactly 3
{2,}- 2 or more
{1,4}- between 1 and 4
Anchors & boundaries
^- start of string (or line with m)
$- end of string (or line with m)
\b- word boundary
\B- not a word boundary
Groups
(abc)- capture group
(?:abc)- group without capturing
(?<name>abc)- named capture group
a|b- a or b
(?=abc)- followed by abc
(?!abc)- not followed by abc