RegexLab

Regular Expression Tester & Playground

Live match highlighting, capture groups, replace mode, and a cheatsheet — all in your browser. Nothing leaves your device.

/
flags g i m s u d
0 matches
copy

Test String

sample clear replace

Matches

copy matches
Matches will appear here…

Match Details

index · value · position · groups
No matches yet.

Common Patterns — click to load

Quick Reference

.Any character (except newline, unless s flag)
\d \w \sDigit · word char [A-Za-z0-9_] · whitespace
\D \W \SNegated versions of the above
[abc]Character set — any of a, b, c
[^abc]Negated set — none of a, b, c
^ $Start / end of string (or line with m flag)
\b \BWord boundary / non-boundary
a* a+ a?0+ · 1+ · optional
a{n} a{n,} a{n,m}Exactly n · n or more · between n and m
(abc) (?:abc)Capturing group · non-capturing group
a|bAlternation — a or b
(?<name>a)Named capture group (use u flag recommended)