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-whitespace
Anchors
^ - Start of string
$ - End of string
\b - Word boundary
\B - Non-word boundary
Quantifiers
* - 0 or more
+ - 1 or more
? - 0 or 1
{n} - Exactly n
{n,} - n or more
{n,m} - Between n and m
Groups & 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
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: \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 .