Why it matters
Regular expressions power form validation, redirects, search and data clean-up, and they're notoriously hard to read. Testing against real examples is the only reliable way to know a pattern does what you mean.
This tester uses your browser's own JavaScript engine, so what matches here matches in your site's code. Results are capped at 1,000 matches so a pattern that matches everything can't flood the page.
How it works
- InputA regular expression and some text
- In your browserRun by the browser's own RegExp engine
- OutputHighlights, groups, a replace preview and a plain-English breakdown
Where it fits in a designer's workflow
- Plan
- Design
- Build
- Test
- Launch
By the numbers
Show the numbers as a table
| Preset | Matches | Parts explained |
|---|---|---|
| 2 | 11 | |
| UK postcode | 5 | 28 |
| UK phone | 2 | 14 |
| Web address | 2 | 13 |
| Hex colour | 2 | 7 |
| Date (YYYY-MM-DD) | 2 | 23 |
| Extra spaces | 3 | 2 |
How to use it
- Type a pattern and flags, or pick an example.
- Paste text to test against.
- Read the matches and groups in the table.
- Try a replacement and download the result.
FAQ
Which regex flavour is this?
JavaScript (ECMAScript), as used in browsers and Node.js. Most syntax is shared with PHP, Python and others, but look-behind and named groups differ slightly.
Why does my pattern match only once?
Add the g flag to find every match.
Is the UK postcode pattern complete?
It covers the standard formats, including GIR 0AA. For certainty, check against Royal Mail's address data.
Can a pattern freeze the page?
Some patterns with nested repeats (like (a+)+) can take very long on certain text. That's called catastrophic backtracking; if the page slows down, simplify the repeats.