Regex Debugger
Test and debug regular expressions in your browserPattern
Flags:finds all matches
Flag examples:
Test string
Highlighted matches
Enter a test string above…
Frequently Asked Questions
What is a regex tester?
A regex tester lets you write a regular expression pattern and test it against sample text in real time. Matches are highlighted, capturing groups are listed with their values, and the current regex flags (global, case-insensitive, multiline) are applied as you type.
What is the difference between a greedy and a lazy quantifier in regex?
Greedy quantifiers (*, +, {n,}) match as many characters as possible. Lazy (reluctant) quantifiers (*?, +?, {n,}?) match as few as possible. For example, <.+> on "<b>bold</b>" greedily matches the entire string; <.+?> lazily matches just "<b>". Add ? after any quantifier to make it lazy.
How do capture groups work and how do I reference them?
Parentheses create a capture group: (\d{4}) captures four digits. Groups are numbered left to right by their opening parenthesis — $1 or \1 in replacements, match.group(1) in Python, match[1] in JavaScript. Named groups use (?P<name>...) in Python or (?<name>...) in JavaScript/PCRE: reference with \k<name> or match.groups.name.
What is the difference between regex flags g, i, m, and s?
g (global) finds all matches rather than stopping at the first. i (case-insensitive) matches A and a equally. m (multiline) makes ^ and $ match line boundaries rather than just the string start/end. s (dotAll) makes . match newline characters as well as all other characters. Flags can be combined: /pattern/gim.
How do I match special characters like . * + ? in regex?
Escape them with a backslash: \. matches a literal dot, \* a literal asterisk. The characters that need escaping in most regex flavours are: . * + ? ^ $ { } [ ] | ( ) \ /. In character classes [ ], only ], \, ^, and - have special meaning and need escaping.
What is the difference between \d and [0-9] in regex?
\d matches any Unicode digit in Unicode-aware engines (including Arabic-Indic numerals, etc.) or just ASCII 0–9 in non-Unicode mode. [0-9] always matches only ASCII digits 0 through 9. In most web and backend contexts they are interchangeable, but for strict ASCII digit matching [0-9] is more explicit and portable.
About Regex Debugger
Test your regular expressions against sample text. See match highlighting, capture groups and flags. All processing in the browser.