Regex tester
Test regular expressions as you type: matches are highlighted, with capture groups, named groups and a replace preview. Includes ready-made patterns for emails, UK postcodes, UK mobile numbers and dates. Runs in your browser.
Runs in your browser. Nothing is uploaded.Quick regex cheat sheet
| Pattern | Matches |
|---|---|
\d \w \s | A digit, a word character (letter, digit or _), a space |
. | Any character except a new line |
[abc] [^abc] [a-z] | One of a, b or c; anything except them; a lowercase letter |
* + ? {2,4} | 0 or more, 1 or more, optional, 2 to 4 times |
^ $ \b | Start of text (or line with m), end, a word boundary |
(…) (?<name>…) (?:…) | A capture group, a named group, a group that doesn't capture |
a|b | a or b |
(?=…) (?!…) | Followed by, not followed by |
This tester uses JavaScript's regex engine, which is the same as in Node.js and every browser. Most simple patterns also work in Python, PHP and Java, but look-behind, named groups and flags vary slightly.
A pattern that takes more than 1.5 seconds is stopped automatically, so a runaway expression can't freeze your browser.
Questions
Why doesn't my pattern match across lines?
By default . doesn't match a new line and ^ and $ match the start and end of the whole text. Turn on s to let . match new lines, and m to make ^ and $ work on each line.
How do I match a full stop or bracket?
Put a backslash before it: \. matches a full stop and \( an opening bracket.
Is my text sent anywhere?
No. Matching happens in your browser.
More free tools
Meta description generator
Write meta descriptions and preview your Google listing.
Website screenshot
Capture any website on desktop, tablet or mobile.
JSON formatter
Format, validate and minify JSON.
Website speed test
Core Web Vitals and Google PageSpeed scores for any page.
DNS propagation checker
See what 8 public DNS providers return for your domain.
Invoice generator
Make a professional invoice with VAT and save it as a PDF.
Merge PDF
Combine several PDFs into one file, in any order.
Compress PDF
Make PDFs smaller for email and uploads.