Use the Regex Tester
What is the Regex Tester? It runs a JavaScript regular expression against sample text and shows matches in Highlighted Text, with each match's index, length, and capture groups in Matches.
How the Regex Tester Works
Enter a pattern between the slash marks and toggle the visible flag buttons: g, i, m, s, u, and y. The tool uses the browser's native JavaScript RegExp engine.
When neither g nor y is selected, the implementation adds g internally to enumerate matches. This can differ from a single native non-global RegExp.exec call.
What the Results Show
- Highlighted Text marks non-empty matches inline. Zero-length matches appear as thin red markers between characters.
- Matches lists each match's text, index, length, numbered capture groups, and named groups.
- A valid pattern with no results shows No matches found. An invalid pattern shows an inline Invalid pattern message.
How to Use the Regex Tester
- Type a pattern into the pattern field.
- Toggle the visible flag buttons.
- Enter or paste sample text. Select Upload to open a
.txtfile picker; the file is read as text. Dropped files are also read as text. - Review Highlighted Text and Matches. Results update when the pattern, sample text, or flags change.
Zero-Length Matches and the 5,000-Match Cap
Patterns such as a* or (?:) can produce zero-length matches. After an empty match, the scan position advances by one UTF-16 code unit so it can continue without stalling.
The tool reports a maximum of 5,000 matches. When the cap is reached, the stats show capped at 5000, so the displayed results and total do not include matches beyond that limit. An empty pattern or empty sample text shows an instructional placeholder.
Copy and JSON
When at least one match is listed, Copy sends tab-separated match number, text, index, and length to the browser Clipboard API. The page does not show a success or failure message, so copying may not complete in every browser context.
JSON downloads regex-matches.json with each match's text, index, length, zeroLength, numbered groups, and named groups. With no matches, both controls return without taking action.
Browser-Side Processing and Limitations
Matching and file reading are implemented in browser-side JavaScript. The inspected tool code does not establish an absolute privacy guarantee for the whole page. Only g, i, m, s, u, and y are exposed as flag controls, and results are capped at 5,000 matches.
Frequently Asked Questions (FAQs)
Which regex flavor does this tool use?
It uses your browser's native JavaScript regular expression engine (the same one used by RegExp in JS), so behavior matches what you'd get in a Node.js or browser script.
What flags are supported?
g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), and y (sticky). Toggle any combination and matches update instantly.
How are zero-length matches handled?
Patterns that can match an empty string (like a* or (?:)) are detected and the scan position is advanced by one UTF-16 code unit after each empty match, so the tool reports them without freezing the page.
Does this tool extract or export matches like a data set?
There is no dedicated extraction or data-set workflow. When matches exist, you can download their current details as JSON by selecting JSON.