Regex Tester
Test regular expressions against sample text.
2 match(es)
Live preview
About Regex Tester
Test and debug regular expressions online for free with live match highlighting. Type your pattern and flags, paste in some sample text, and every match lights up instantly as you type - making it easy to build and fix regex for validation, search-and-replace, log parsing, and scraping. It uses JavaScript's native RegExp engine, so what you see here behaves exactly like regex in Node.js and the browser. Nothing is uploaded; your patterns and test data stay in your browser, so it's safe to use with real data while you iterate on tricky expressions.
How to use this tool
- 1Enter your regular expression pattern and flags.
- 2Paste sample text into the test area.
- 3Matches are highlighted live as you type.
Regex quick-reference
The handful of metacharacters below cover the vast majority of everyday regular expressions. Keep this table handy while testing patterns above.
| Token | Matches |
|---|---|
| . | Any single character except newline |
| \d / \D | A digit / anything but a digit |
| \w / \W | Word character (letter, digit, _) / non-word |
| \s / \S | Whitespace / non-whitespace |
| ^ / $ | Start / end of string (or line with the m flag) |
| * / + / ? | 0 or more / 1 or more / 0 or 1 of the previous token |
| {2,5} | Between 2 and 5 of the previous token |
| [abc] / [^abc] | Any of a, b, c / anything except a, b, c |
| (x|y) | x or y, captured as a group |
| (?:x) | x, grouped but not captured |
Two common gotchas: quantifiers are greedy by default (add ? to make them lazy, e.g. .*?), and characters like . + ? ( ) [ ] need escaping with a backslash when you want to match them literally.
Frequently asked questions
Which regex flavor is used?
It uses JavaScript's built-in RegExp engine, so ECMAScript regex syntax and flags apply.
What do the flags mean?
Common flags: g (global, all matches), i (case-insensitive), m (multiline), s (dotall).
Related guide
8 min readRegular Expressions for Beginners: A Practical Crash Course
Learn regex from zero with plain-English explanations and real patterns you can copy - emails, dates, phone numbers, and the gotchas that trip everyone up.