Regex Tester with Explanation — Free Online Tool
Test regular expressions in real-time with live match highlighting, group capture, and plain-English explanations.
/
/
Cheatsheet — click to insert
What is a Regular Expression?
A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. They're used for string searching, validation, text extraction, and replacement. Regex is supported in virtually every programming language and is an essential tool for any developer working with text processing.
Regex Syntax Quick Reference
.— Matches any character except newline^/$— Start / end of string (or line in multiline mode)*/+/?— 0 or more / 1 or more / 0 or 1{n,m}— Between n and m repetitions[abc]— Character class — matches a, b, or c[^abc]— Negated character class(abc)— Capturing group(?:abc)— Non-capturing group\d/\w/\s— Digit / word character / whitespacea|b— Alternation — matches a or b
Common Regex Patterns
- Email:
[\w.+-]+@[\w-]+\.[a-zA-Z]{2,} - URL:
https?://[\w\-._~:/?#[\]@!$&'()*+,;=%]+ - IPv4:
(\d{1,3}\.){3}\d{1,3} - Phone (US):
(\+1\s?)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4} - Hex color:
#([a-fA-F0-9]{6}|[a-fA-F0-9]{3}) - Date (YYYY-MM-DD):
\d{4}-\d{2}-\d{2}