⚙️ Regex Tester
Test and debug regular expressions against any text in real time. All matches are highlighted, with match count, positions and capture groups displayed. Free, private, no signup.
Quick Reference
| Pattern | Matches |
|---|---|
| . | Any character except newline (use s flag to include newlines) |
| \d | Any digit (0–9). \D matches non-digits |
| \w | Word character [a-zA-Z0-9_]. \W matches non-word characters |
| \s | Whitespace (space, tab, newline). \S matches non-whitespace |
| ^ | Start of string (or line with m flag) |
| $ | End of string (or line with m flag) |
| * | Zero or more of the preceding token |
| + | One or more of the preceding token |
| ? | Zero or one of the preceding token (also makes quantifiers lazy) |
| {n,m} | Between n and m repetitions of the preceding token |
| [abc] | Any character in the set. [^abc] matches characters NOT in the set |
| (abc) | Capturing group. (?:abc) is non-capturing. (?<name>abc) is named |
| a|b | Either a or b (alternation) |
| (?=abc) | Positive lookahead — followed by abc |
| (?!abc) | Negative lookahead — not followed by abc |
About the Regex Tester
This tool runs JavaScript regular expressions against your test string and displays every match highlighted in the original text. It uses the JavaScript (ECMA-262) regex engine, so patterns work exactly as they would in a browser or Node.js application.
Understanding the Flags
- g (global) — finds all matches instead of stopping after the first. Almost always needed
- i (case insensitive) — makes the match ignore upper/lower case differences
- m (multiline) — makes
^and$match the start and end of each line, not just the whole string - s (dotAll) — makes the dot (
.) match newline characters as well as other characters
Common Use Cases
- Testing regex patterns before pasting them into code
- Debugging a pattern that isn't matching what you expect
- Validating email, phone, URL or date formats
- Finding patterns to use with the Find & Replace tool
- Learning how different regex constructs behave
Frequently Asked Questions
What regex flavour does this tester use?
+This tester uses JavaScript's built-in regular expression engine (ECMA-262). It supports character classes, quantifiers, groups, lookaheads, lookbehinds, named capture groups and Unicode property escapes. Patterns are equivalent to those you would use with String.match() or new RegExp() in JavaScript.
What do the flags g, i, m, s do?
+g (global) finds all matches instead of stopping at the first. i (case insensitive) ignores letter case. m (multiline) makes ^ and $ match line boundaries. s (dotAll) makes the dot match newlines too. You can combine any flags.
How do I see capture groups?
+Any groups you define with parentheses in your pattern are shown in the match list below the highlighted text. Each match entry shows the full match value, its position in the string, and any captured subgroups labelled Group 1, Group 2 etc. Named groups (like (?<year>\d{4})) are shown by name.
Is there a limit on text or pattern size?
+No hard limit. Very complex patterns with many backtracking paths may run slowly on large texts — this is a property of the regex engine, not the tool. Catastrophic backtracking is possible with poorly designed patterns; if the page becomes unresponsive, refresh and simplify your pattern.