Regex Tester & Debugger

Test and debug your regular expressions with real-time matching

Matches will be highlighted here...
How to Use
🔍 Test Patterns

Enter your regex pattern and test text to see matches in real-time. Matches are highlighted automatically.

⚙️ Configure Flags

Toggle regex flags like global, case-insensitive, multiline, and more to modify matching behavior.

💡 Use Cases

• Validate email addresses
• Extract URLs from text
• Find phone numbers
• Parse dates and formats
• Debug complex patterns

📚 Regex Reference Guide - Learn What Each Character Does
Anchors (Position)
CharacterMeaningExample
^Start of string/line^Hello matches "Hello" at start
$End of string/lineworld$ matches "world" at end
\bWord boundary\bcat\b matches "cat" but not "category"
\BNot a word boundary\Bcat\B matches "cat" inside words
Character Classes
CharacterMeaningExample
.Any character (except newline)a.c matches "abc", "a1c"
\dDigit (0-9)\d\d matches "12", "99"
\DNot a digit\D\D matches "ab", "xy"
\wWord character (a-z, A-Z, 0-9, _)\w+ matches "hello", "test123"
\WNot a word character\W matches " ", "@", "!"
\sWhitespace (space, tab, newline)\s+ matches spaces
\SNot whitespace\S+ matches "hello"
[abc]Any of a, b, or c[aeiou] matches vowels
[^abc]Not a, b, or c[^0-9] matches non-digits
[a-z]Range: a to z[0-9] matches digits
Quantifiers (Repetition)
CharacterMeaningExample
*Zero or morea* matches "", "a", "aa"
+One or morea+ matches "a", "aa" (not "")
?Zero or one (optional)colou?r matches "color", "colour"
{n}Exactly n times\d{3} matches "123"
{n,}n or more times\d{3,} matches "123", "1234"
{n,m}Between n and m times\d{2,4} matches "12", "123", "1234"
*?Lazy (non-greedy) zero or morea.*?b matches shortest "a...b"
+?Lazy (non-greedy) one or morea.+?b matches shortest "a...b"
Groups & Alternation
CharacterMeaningExample
(abc)Capture group(\\d{3}) captures "123"
(?:abc)Non-capturing group(?:abc)+ groups without capturing
a|bAlternation (a or b)cat|dog matches "cat" or "dog"
\\1Backreference to group 1(\\w)\\1 matches "aa", "bb"
Escaped Characters
CharacterMeaningExample
\\nNewlineline\\n matches line with newline
\\tTab\\t matches tab character
\\rCarriage return\\r\\n matches Windows line break
\\.Literal period\\. matches "." (not any char)
\\+Literal plus\\+ matches "+" (not quantifier)
\\*Literal asterisk\\* matches "*" (not quantifier)
\\?Literal question mark\\? matches "?" (not quantifier)
\\\\Literal backslash\\\\ matches "\\"
Common Patterns
PatternMatches
^[a-zA-Z]+$Only letters (no spaces/numbers)
^\\d+$Only digits
^[a-zA-Z0-9]+$Alphanumeric only
^.{3,20}$3 to 20 characters
^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}$Email address (basic)
\\b\\d{3}-\\d{3}-\\d{4}\\bPhone number (123-456-7890)
https?://[\\w\\-]+(\\.[\\w\\-]+)+URL (http or https)