Regular Expression Tester

Test regular expressions with real-time matching and capture groups

← Back to Tools

Pattern & Test Text

//

Character Classes:

\d - digit [0-9]
\D - non-digit
\w - word [a-zA-Z0-9_]
\W - non-word
\s - whitespace
\S - non-whitespace
. - any char (except \n)
[abc] - a, b, or c
[^abc] - not a, b, or c
[a-z] - range a to 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
+? - lazy 1 or more

Anchors & Boundaries:

^ - start of string/line
$ - end of string/line
\b - word boundary
\B - non-word boundary

Groups & Lookaround:

(...) - capturing group
(?:...) - non-capturing group
(?=...) - positive lookahead
(?!...) - negative lookahead
(?<=...) - positive lookbehind
(?<!...) - negative lookbehind
| - alternation (or)

Common Patterns:

^\d{3}-\d{3}-\d{4}$ - Phone: 123-456-7890
^[\w.-]+@[\w.-]+\.\w+$ - Email (basic)
^https?://.* - URL starting with http/https
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$ - Hex color
^\d{4}-\d{2}-\d{2}$ - Date: YYYY-MM-DD
^(?=.*[A-Z])(?=.*[a-z])(?=.*\d).{8,}$ - Strong password

Escape Characters:

\\ - backslash
\n - newline
\t - tab
\r - carriage return

Matches

No matches found