Regex Tester — Test Regular Expressions Live
Test regular expressions with real-time matching. Highlights all matches in your text.
Regular expressions are a pattern language for finding and validating text — email shapes, date formats, log lines, you name it. This tester shows every match live as you type the pattern, so you can iterate quickly instead of guess-and-refresh in code.
How to test a regular expression
- Type your pattern in the regex field — leading and trailing slashes not needed.
- Paste sample text into the test-string area.
- Matches highlight instantly as you type either side.
- Iterate on the pattern until you capture exactly what you need, then copy it into your code.
A practical regex example
\d means any digit, {4} means exactly four of them — so this pattern finds ISO-style dates anywhere in text. Small building blocks like these combine into patterns far more precise than any find-and-replace.
\d{4}-\d{2}-\d{2} matches 2026-09-17Frequently asked questions
Which regex flavor does this use?
JavaScript (ECMAScript) regex, matching what runs in every browser and Node.js. Other languages (Python, PCRE) have small differences like lookbehind support and named-group syntax.
Why doesn’t my pattern match across lines?
By default ^ and $ anchor to the whole string, and . doesn’t match newlines. Enable multiline (m) or dotall (s) flags where available, or use [\s\S] instead of a dot.
My regex works here but not in my code — why?
Check escaping: in many languages the string literal eats one level of backslashes, so "\d" written in code becomes d in the actual pattern.
Can regex validate an email perfectly?
Fully RFC-compliant email regex is famously monstrous. In practice a simple pattern plus a confirmation email is the robust approach.