Regex Tester
Test regular expressions with real-time match highlighting, match count, and group captures. Runs in your browser.
How to Use
Enter a regular expression
Type your regex pattern in the pattern field. The surrounding slashes (/ /) are displayed for readability but are not part of the pattern.
Toggle flags as needed
Use the flag buttons below the pattern field: g (global β find all matches), i (case-insensitive), m (multiline β ^ and $ match line boundaries), s (dotAll β dot matches newline).
Enter the test string
Type or paste the text you want to test in the Test String field. Matches are highlighted in real time.
Review match details
The match count appears in the status bar. Scroll the Match Details list to see each match's value, position, length, and any captured groups.
FAQ
This tool uses the JavaScript built-in RegExp engine (ECMAScript regex). It supports character classes (\d, \w, \s), quantifiers (*, +, ?, {n,m}), anchors (^, $), lookahead/lookbehind, named groups, and more.
Without the g flag, the regex engine stops after the first match. With g, it finds every non-overlapping match in the entire text. This tool always finds all matches for display purposes, but the flag also affects the regex literal representation shown in the pattern bar.
Capture groups are parts of a regex enclosed in parentheses, e.g. (\d+). They let you extract sub-parts of a match. For example, the pattern (\d{4})-(\d{2})-(\d{2}) applied to "2024-01-15" produces groups ["2024", "01", "15"].
To prevent the browser from freezing on patterns that produce thousands of matches in very long texts, the tool caps displayed matches at 1000. The match count shown may read "1000" if the actual count exceeds this limit.