Enter a regex and test text to see live match count, positions and capture groups. Replace mode supports $1 $2 backreferences.
⚡
Enter a regex to see live match results and capture groups
📖 Quick Reference
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}1[3-9]\d{9}https?://[\w\-]+(\.[\w\-]+)+(/[\w\-._~:/?#\[\]@!$&'()*+,;=%]*)?[\u4e00-\u9fa5]+((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)\d{4}[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12]\d|3[01])<([a-zA-Z][a-zA-Z0-9]*)\b[^>]*>(.*?)</\1>#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})\b❓ FAQ
What do the g, i, m, s, u flags mean?
g (global) finds all matches instead of just the first; i (ignoreCase) makes matching case-insensitive; m (multiline) makes ^ and $ match line boundaries; s (dotAll) lets . match newlines; u (Unicode) enables full Unicode support for emoji and 4-byte characters.
How do I extract capture group content?
Use parentheses () to define capture groups. For example, (\d{4})-(\d{2})-(\d{2}) extracts year, month, and day from a date. This tool shows $1, $2, etc. in the match details. Named groups use (?<name>...) syntax.
How do I use $1 and $2 in replace mode?
In the replacement string, $1 refers to the first capture group, $2 to the second, and so on. For example, with regex (\w+)@(\w+) and replacement $2/$1, 'user@domain' becomes 'domain/user'. Named groups use $<name>.
Why does my regex match here but not in my code?
Common causes: 1) In string literals, backslashes need doubling — write \\d in code for the regex \d; 2) Missing g flag causes only the first match to be found; 3) Multiline text needs the m flag for ^ and $ to match line boundaries; 4) Strings with emoji need the u flag.