Test and debug regular expressions with real-time pattern matching, match highlighting, and capture groups display.
Example: Pattern: \b\w+@\w+\.\w{2,}\b matches [email protected]
📝 Regex Tester
/
/
0 matches found
0ms
💡 Highlighted Matches
🎯 Capture Groups
📋 All Matches
📚 Regex Cheat Sheet ▼
Character Classes
.
- Any character except newline\w
- Word character [a-zA-Z0-9_]\W
- Non-word character\d
- Digit [0-9]\D
- Non-digit\s
- Whitespace\S
- Non-whitespaceAnchors
^
- Start of string$
- End of string\b
- Word boundary\B
- Non-word boundaryQuantifiers
*
- 0 or more+
- 1 or more?
- 0 or 1{n}
- Exactly n{n,}
- n or more{n,m}
- Between n and mGroups & Lookarounds
(abc)
- Capture group(?:abc)
- Non-capturing group(?=abc)
- Positive lookahead(?!abc)
- Negative lookahead(?<=abc)
- Positive lookbehind(? - Negative lookbehind
❓ Frequently Asked Questions
What is a regular expression? +
A regular expression (regex) is a pattern used to match character combinations in strings. It's a powerful tool for searching, validating, and manipulating text. Regex patterns use special characters and syntax to define search criteria.
What do the flags mean? +
• g (global): Find all matches, not just the first
• m (multiline): ^ and $ match line breaks
• i (case insensitive): Ignore case differences
• s (dotAll): . matches newlines
• u (unicode): Enable full Unicode support
• m (multiline): ^ and $ match line breaks
• i (case insensitive): Ignore case differences
• s (dotAll): . matches newlines
• u (unicode): Enable full Unicode support
How do capture groups work? +
Capture groups are parts of a regex pattern enclosed in parentheses (). They allow you to extract specific parts of a match. For example, in the pattern
(\d{3})-(\d{4})
, the first group captures the first 3 digits, and the second group captures the last 4 digits.
What are some common regex patterns? +
• Email:
• Phone:
• URL:
• Date:
• IP Address:
\b\w+@\w+\.\w{2,}\b
• Phone:
\b\d{3}[-.]?\d{3}[-.]?\d{4}\b
• URL:
https?://[^\s]+
• Date:
\d{4}-\d{2}-\d{2}
• IP Address:
\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
How can I match special characters? +
To match special regex characters literally (like ., *, +, ?, etc.), you need to escape them with a backslash (\). For example, to match a literal period, use
\.
instead of just .