Regex Tester
Test regular expressions with real-time matching
About the Regex Tester
Regular expressions are powerful and famously unforgiving — a single misplaced character can change everything a pattern matches. The Regex Tester gives you a live workbench: type a pattern, paste some sample text, and watch every match light up instantly.
It mirrors how people actually debug regex. A developer validating an email or phone format pastes a dozen real examples to see which ones slip through. Someone writing a log parser tweaks a capture group and immediately sees whether it grabs the timestamp correctly. Support engineers use it to build the search-and-replace pattern they will paste into another tool, confident it does what they expect first.
Matches are highlighted directly in your test text, and each one is broken out below with its capture groups, position, and length — so you are not just told "3 matches", you can see exactly where and what they are.
How to Use the Regex Tester
- Type your pattern into the expression field (the slashes around it are shown for you).
- Set flags either by typing them in the flags box or by clicking the g, i, m, s, u, and y toggle buttons.
- Paste the text you want to test into the "Test Text" area.
- Watch matches highlight in yellow as you type; the header shows the live match count.
- Scroll the match details to inspect each capture group, index, and length, then click "Copy Regex" to copy your pattern in /pattern/flags form.
Why Use ToolForge’s Regex Tester
- It uses your browser's native JavaScript RegExp engine, so what you test here behaves exactly like the regex in your JavaScript code — no dialect surprises.
- All six JavaScript flags (g, i, m, s, u, y) are available as one-click toggles, so you do not have to remember which letter does what.
- Matches are highlighted in place and each is itemized with its capture groups, start index, and length, which makes debugging groups far easier than a bare match count.
- Everything runs locally and updates in real time — paste sensitive log data without it ever being uploaded.
Frequently Asked Questions
Which regex flavor does this tester use?
It uses the JavaScript (ECMAScript) regular expression engine built into your browser. Patterns that rely on features from other flavors — such as PCRE lookbehind in older engines or named groups syntax differences — may behave differently than in Python, PHP, or Java.
What do the g and m flags actually do?
The "g" (global) flag finds all matches instead of stopping at the first. The "m" (multiline) flag makes the ^ and $ anchors match at the start and end of each line rather than only the whole string. You can toggle both with the flag buttons and watch the matches change.
Why is only the first match highlighted?
Without the global flag, a regex returns only the first match. Turn on the "g" flag (or click the g button) and the tester will find and highlight every match in your text.
My pattern shows an error — what is wrong?
The tester reports the exact error from the RegExp engine, usually a syntax problem such as an unclosed bracket or group, or an invalid escape sequence. Fix the highlighted issue in the pattern and matching resumes automatically.
