This regex tester lets you write a JavaScript regular expression and see every match highlighted in your test text as you type. It also lists the matches and shows capture groups, so you can check a pattern before it goes into your code. It is free and made for developers, students, analysts and anyone who cleans up text.
How do you use the regex tester?
The tool has a pattern box, a flags box and a test text area. Matches update as you type, so there is no run button to hunt for.
- Enter your regex and flags. Type the pattern, then add flags such as g (all matches), i (ignore case) or m (multiline).
- Type or paste your test text. Use a realistic sample: a few log lines, a list of emails, or a paragraph from your real data.
- Read the matches. Matches are highlighted in the text, and the match list shows each one with its capture groups.
- Adjust and repeat. Change one part of the pattern at a time and watch what the highlighting does.
- Check the cheat sheet. If you forget what a token means, the built-in cheat sheet is there.

Need to go a step further? The Find and Replace and the JSON Formatter & Validator work the same way, right in your browser.
Your text is processed in your browser, so nothing is uploaded to a server.
What is a regex tester good for?
Regular expressions are easy to get almost right. A tester shows you the exact spot where a pattern goes wrong.
- Form validation. Try a pattern for postcodes, phone numbers or usernames against both good and bad samples.
- Extracting data. Pull order numbers, dates or prices out of logs, emails or exported text.
- Find and replace. Confirm which lines a pattern will hit before you run it in your editor or script.
- Learning. Beginners can see what each token does, one character at a time.
- Debugging. If a pattern matches too much, the highlighting usually shows why.

Regex examples you can try
Paste these into the tool to see how matches and groups look. Each one uses the g flag unless noted.
| Pattern | Test text | What it matches |
|---|---|---|
| \d+ | Order 66 shipped in 3 days | 66 and 3 |
| (\d{4})-(\d{2})-(\d{2}) | Due 2025-03-14 | The full date, with groups 2025, 03 and 14 |
| colou?r (flag i) | Color, colour, COLOR | All three spellings |
| ^\s+|\s+$ | " padded text " | Leading and trailing spaces |
| \b[A-Z][a-z]+\b | Sam met Priya in Leeds | Sam, Priya and Leeds |
Tips for better regex results
- Test with bad input too. A pattern that accepts valid data but also accepts junk is not finished.
- Build in small steps. Start with one literal piece, confirm it matches, then add the next piece.
- Use anchors when you need a full match. Without ^ and $, a pattern can match a small part of a longer string.
- Prefer specific tokens over the dot. .* is greedy and often grabs more than you meant. Try [^"]* or a lazy .*? instead.
- Use groups on purpose. Wrap only the parts you want to read back. Use (?:...) when you need grouping without capturing.
- Include edge cases. Add empty lines, extra spaces, capital letters and odd punctuation to your sample.
Why is my regex not matching?
You forgot the g flag
Without g, JavaScript stops at the first match. If you expect several highlights and see one, add the flag.
Special characters are not escaped
Characters like . ? + * ( ) [ ] { } | \ have special meanings. To match a literal dot, write \..
Case or line breaks are getting in the way
Add i to ignore case. Add m if you want ^ and $ to work on each line instead of the whole text.
The pattern matches too much
Greedy quantifiers take as much text as they can. Make the pattern narrower, or switch to a lazy quantifier.
Is a JavaScript regex the same as other languages?
Mostly, but not always. This tool tests JavaScript regular expressions, so results match what you will get in a browser or in Node.js. Other languages differ in small ways.
- Named groups are written (?<name>...) in JavaScript, while Python uses (?P<name>...).
- JavaScript has no possessive quantifiers or atomic groups.
- Escaping rules inside strings add extra backslashes in many languages, even when the regex itself is the same.
If you are writing for another language, use this page to check the core logic, then test again in that language.
