Regex Tester
Test regular expressions against sample text with match highlighting.
Last updated: August 2026
Was this tool helpful?
Testing patterns without guesswork
A regular expression is a compact language for describing text patterns. A tester lets you paste a pattern and sample text, then highlights every match and shows the captured groups, so you can see exactly what your expression does instead of running your whole program to find out.
Example
Pattern to pull the area code from a phone number:
Pattern: \((\d{3})\) \d{3}-\d{4}
Input: (415) 555-0199
Group 1: 415The parentheses in (\d{3}) create a capture group, while the literal parentheses around the area code are escaped with backslashes so they match real brackets in the text.
Flags change everything
The same pattern behaves differently depending on flags. The global flag finds all matches instead of just the first, the case-insensitive flag ignores letter case, and the multiline flag makes ^ and $ match at every line boundary rather than only the start and end of the whole string. Forgetting the global flag is the most common reason a replace only touches the first match.
Watch for catastrophic backtracking
Patterns with nested quantifiers such as (a+)+ can take exponential time on certain inputs and hang the engine. If a tester locks up on a specific string, that is usually the cause, and the fix is to make the quantifiers more specific or atomic.
FAQ
Why does my dot not match a newline? By default . matches any character except a line break. Enable the dotall flag if you need it to cross lines.
Are regex dialects the same everywhere? No. JavaScript, PCRE, Python, and others differ on lookbehind, named groups, and escape rules, so a pattern copied from one language may need tweaks in another.
Should I parse HTML with regex? For simple one-off extraction, sometimes. For real nested markup, use a proper parser; regex cannot reliably handle arbitrary nesting.