Regex Tester
What are Regular Expressions?
🌱 New to this?Try our common patterns and learn with live examples
🎯 Advanced user?Enable advanced mode for detailed pattern analysis
Regex Tester & Builder
Matches
Enter a regex pattern above to start testing
Common Patterns
Regex Cheat Sheet
^
Start of line$
End of line.
Any character except newline*
0 or more+
1 or more?
0 or 1\w
Word character [A-Za-z0-9_]\d
Digit [0-9]\s
Whitespace[abc]
Character class(xyz)
Capturing group{n}
Exactly n times{n,}
n or more times{n,m}
Between n and m timesCommon Regex Patterns
Click any example to try it in the tester above
^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$
Match email addresses
Click to try this pattern
URL
https?:\/\/[\w\-\.]+\.[a-zA-Z]{2,}(\/\S*)?
Match web URLs
Click to try this pattern
Phone (US)
^\(?([0-9]{3})\)?[-.\s]?([0-9]{3})[-.\s]?([0-9]{4})$
Match US phone numbers
Click to try this pattern
Date (YYYY-MM-DD)
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$
Match dates in YYYY-MM-DD format
Click to try this pattern
Understanding Regular Expressions
What are Regular Expressions?
Regular expressions (regex) are powerful patterns used to match and manipulate text. They provide a flexible way to search, validate, and transform strings.
Common Use Cases
- Validating email addresses and phone numbers
- Extracting data from structured text
- Finding and replacing patterns in text
- Parsing log files and data formats
Tips for Writing Regex
- Start simple and build up gradually
- Test with various input cases
- Use capturing groups to extract data
- Consider performance for large inputs