Regular Expression Helper
Enter a regex pattern and optional test string to see matches and a token-by-token explanation of what your regex does.
Related Tools
Frequently Asked Questions
What is a lookahead in regex?
A positive lookahead (?=...) asserts that the pattern inside must follow the current position, without consuming characters. \w+(?=@) matches the username part of an email without including the @ sign in the match.
What is the difference between greedy and lazy quantifiers?
Greedy quantifiers (*, +, {n,}) match as much as possible. Lazy/non-greedy variants (*?, +?, {n,}?) match as little as possible. For <.+> on <b>text</b>, greedy matches the whole string; lazy matches just <b>.
How do I match a literal dot in regex?
A bare . in regex matches any character except newline. To match a literal period, escape it with a backslash: \. So to match a URL like example.com, use example\.com.