Regex Tester
Test regular expressions with live match highlighting and capture group details.
Common Patterns
Frequently Asked Questions
What are regex flags?βΌ
Flags modify matching behavior. g (global) finds all matches, not just the first. i (case-insensitive) treats A and a as the same. m (multiline) makes ^ and $ match line starts/ends instead of string start/end. s (dotAll) makes . match newlines too.
What is the difference between . and \w in regex?βΌ
. matches any single character except newline (with dotAll flag, including newline). \w matches word characters: letters, digits, and underscore β equivalent to [A-Za-z0-9_]. \W is the opposite (non-word characters).
What are capture groups?βΌ
Parentheses create capture groups: (\d+) captures one or more digits. Groups are numbered from left to right starting at 1. Named groups use (?<name>pattern). Groups let you extract specific parts of a match and reuse them in replacements.
What does + vs * vs ? mean?βΌ
+ means one or more (\d+ matches '1' or '123'). * means zero or more. ? means zero or one (makes the preceding element optional). {n} means exactly n times. {n,m} means between n and m times.