Regular Expression Tester
Test a regex against text and see every match highlighted.
What this tool does
Regular expressions are powerful but notoriously hard to get right. This tester lets you try a pattern against sample text and see matches instantly โ with flags and groups โ before you put it into real code.
How to use this tool
- 1
Write the pattern
Do not include the surrounding slashes; type the expression itself.
- 2
Set the flags
g finds every match instead of stopping at the first, i ignores case, m makes ^ and $ work per line.
- 3
Paste a test string
Use real text from your data, including the awkward cases.
- 4
Check the matches
Every match is highlighted, and the count tells you whether the pattern is too greedy.
When to use it
- You are writing a pattern to validate an email, phone number or postcode.
- You want to extract part of a string, like a number from a log line.
- You are debugging a regex that matches too much or too little.
- You are learning regex by experimenting with live feedback.
How to understand this tool
The pattern is JavaScript regex, so syntax and behaviour from Python, PHP or PCRE may differ slightly. Greedy quantifiers such as .* consume as much as they can before backtracking, which is why a pattern can match far more than intended, and why a badly written pattern can hang the browser on a long string.
What it will not do
- It does not run replacement or explain the pattern for you.
- It only tests; it does not validate that the same expression works in another language.
Questions people ask
What do the flags mean?
For example, "i" makes matching case-insensitive and "g" finds all matches, not just the first.
Why does my pattern work here but not in my code?
Different regex engines support different features. Check your language's dialect.
One thing worth knowing
This is a lightweight browser tool โ for production-critical work, pair it with your normal linters and tests.