Regex tester with live highlighting
Type a regular expression and a test string and see every match highlighted instantly, with match positions and capture groups listed. Toggle flags, try a replacement with $1-style references and load common patterns for emails, URLs, UK postcodes and phone numbers.
How to test a regex
Write the pattern without slashes, choose flags, then paste sample text. Include both text that should match and text that should not, so you catch patterns that are too loose. The tool stops runaway patterns after a short time so a catastrophic-backtracking mistake will not freeze your browser.
JavaScript regex flavour
The tester uses your browser's JavaScript engine. Most basic syntax is shared with Python, PHP (PCRE), Java and others, but check differences for named groups, lookbehind support and flags before copying a pattern into another language.
Common mistakes
Forgetting to escape dots and slashes, using greedy .* where a lazy .*? is needed, anchoring with ^ and $ without the multiline flag, and validating emails with an over-strict pattern. Test edge cases.
Need a pattern written for you?
Use the AI Regex Generator to describe what you want in plain English, then test the result here.