Regex Tester
| # | Match | Position | Groups |
|---|---|---|---|
|
JavaScript literal:
Cheat sheet
. | Any character except a new line |
\d \w \s | Digit, word character, whitespace (capitals mean "not") |
[abc] [^abc] [a-z] | One of, none of, a range |
* + ? {2,5} | 0 or more, 1 or more, optional, between 2 and 5 times |
*? +? | Lazy versions: match as little as possible |
^ $ \b | Start, end, word boundary |
(…) (?:…) (?<name>…) | Capturing, non-capturing and named groups |
a|b | Either a or b |
(?=…) (?!…) (?<=…) (?<!…) | Lookahead and lookbehind |
Regex Tester
Write a regular expression and see immediately what it matches in your test text: every match is highlighted and listed with its position and capture groups, including named groups. Switch flags on and off, try a replacement string with $1 or $<name> references, and look up syntax in the built-in cheat sheet. Patterns run in a background worker, so a runaway pattern cannot freeze the page.
How to use Regex Tester
- Type the pattern, without the surrounding slashes.
- Choose the flags: g for all matches, i to ignore case, m for multi-line anchors, s for dot-all, u for Unicode.
- Paste the test text and look at the highlighted matches and the table of groups.
- Optionally enter a replacement to preview the result.
When it comes in handy
- Building patterns for form validation, log parsing or search and replace.
- Debugging why a regex does not match.
- Learning regular expressions.
Frequently asked questions
Which regex flavour is this?
What happens with catastrophic backtracking?
Related guides
-
How to Fix Invalid JSON: The 8 Most Common Errors
Trailing commas, single quotes, unquoted keys and the other mistakes that break JSON, with before-and-after examples and a quick way to find the problem.
-
Unix Timestamps Explained: Epoch Time for Humans
What a Unix timestamp is, why it counts from 1970, seconds vs milliseconds, time zones, the year 2038 problem, and how to convert timestamps quickly.
-
JSON vs XML vs CSV: Choosing the Right Data Format for Your Project
JSON, XML and CSV each solve a different problem. Here is how to pick the right one, plus tools to convert and validate between them.