Common Regex Patterns
\d+— matches one or more digits[a-zA-Z]+— matches one or more letters^\s+|\s+$— matches leading/trailing whitespace\b\w+\b— matches whole words^[\w.-]+@[\w-]+\.[a-z]{2,}$— basic email validation
Regex Flags
- g (global): find all matches instead of stopping at the first
- i (case-insensitive): ignore case when matching
- m (multiline): ^ and $ match start/end of each line
Frequently Asked Questions
Why does my regex work in one language but not another?
Different programming languages have slight variations in regex syntax. This tool uses JavaScript regex. Python, Java, and PHP have mostly compatible syntax with some differences in lookaheads and named groups.