Regex Tester
Write a regular expression and test it against any input text. See all matches highlighted in context, listed with their positions. Supports all standard JavaScript regex flags (g, i, m, s, u, y). Runs in your browser.
Test a JavaScript-style regular expression against text in your browser. Enter a pattern and flags, then review matched text, match positions, and highlighted results as the tester updates automatically.
How to test a regular expression
- Enter a regular expression pattern without surrounding slash characters.
- Adjust flags such as g, i, m, s, u, or y when needed.
- Paste or type the test text.
- Review the match count, each matched value and index, and the highlighted source text.
How matching works
The tester creates a JavaScript RegExp in the browser. Unsupported flag characters are removed, and the global g flag is added automatically when it is not already present so the page can collect every match with matchAll.
Invalid regular-expression syntax is reported as an error instead of being guessed. Match positions are JavaScript string indexes, and highlighted output shows the exact substrings matched by the expression. The tool is intended for JavaScript-compatible regular expressions rather than PCRE or another regex engine.
Privacy and limitations
Pattern matching runs locally in your browser and the text does not need to be uploaded. Very complex expressions can still be slow on large input, and JavaScript regular-expression behavior can differ from regex engines used by other languages and tools.
Frequently asked questions
Which regex engine does this use?
It uses the JavaScript RegExp implementation provided by your browser.
Which flags are accepted?
The input is limited to JavaScript flags g, i, m, s, u, and y.
Why is g added automatically?
The tester needs global matching to list and highlight every match in the input.
Does it show capture groups?
The current interface lists the full matched substring and its index, not a separate table of capture groups.
Is my test text uploaded?
No. Matching happens entirely in the browser.