Regex Tester
Test regular expressions live
//g
JavaScript (ECMAScript) regular expression syntax.
Regex cheat sheet
| Syntax | Meaning | Example |
|---|---|---|
| \d | Any digit | \d{3} → 010 |
| \w | Letter, digit or underscore | \w+ → hello_1 |
| \s | Whitespace | a\sb → a b |
| . | Any character except a newline | a.c → abc |
| ^ | Start of the string (or line) | ^abc |
| $ | End of the string (or line) | abc$ |
| [abc] | Any one character in the brackets | [aeiou] |
| [^abc] | Any character not in the brackets | [^0-9] |
| (group) | Capture group | (\d+)-(\d+) |
| (?<name>...) | Named capture group | (?<year>\d{4}) |
| a|b | a or b | cat|dog |
| ? | Zero or one | colou?r |
| + | One or more | a+ |
| * | Zero or more | a* |
| {n,m} | Between n and m times | \d{2,4} |
| (?=...) | Lookahead (followed by …) | \d+(?= USD) |
| (?!...) | Negative lookahead (not followed by …) | \d+(?! USD) |
| \b | Word boundary | \bcat\b |
Test a regular expression against your text and see every match highlighted as you type, with capture groups listed. A free online regex tester with flag toggles that runs in your browser.
How to use
- Enter your regular expression and turn on the flags you need (g, i, m…).
- Paste the text to test against — matches are highlighted as you type.
- Check the match list to see each result and its capture groups.
FAQ
- Q. Which regex flavor is used?
- A. JavaScript (ECMAScript) regular expressions, the same engine your browser and Node.js use.
- Q. Why does my pattern only match once?
- A. Turn on the global (g) flag. Without it the engine stops after the first match.
- Q. Are capture groups shown?
- A. Yes. Each match lists its numbered capture groups, so you can confirm the parts you intend to extract.
Spotted something wrong? Let us know.