Regex Tester
Test regular expressions with live matching and highlighting.
About Regex Tester
Debugging a regular expression by trial and error in your code is painful. This free regex tester online gives you instant feedback instead: type a pattern, paste some sample text, and every match is highlighted live as you type. Invalid patterns show the exact syntax error, matched text is color-coded in place, and a details table lists each match with its index, length, and capture groups. Everything runs locally in your browser using the native JavaScript regex engine — your patterns and test data are never sent to a server.
The tool covers the options you actually reach for. Toggle the g, i, m, and s flags with one click to control global, case-insensitive, multiline, and dotall matching, and watch the match count update immediately. A dropdown of common patterns — email address, URL, phone number, IPv4 address, date, and hex color — gives you a working starting point you can adapt instead of writing from scratch. When the pattern behaves the way you want, the Copy button puts the full expression, slashes and flags included, on your clipboard ready to paste into your code.
How to test a regular expression
- 1Type your pattern into the Regular Expression field — no delimiters needed, the surrounding slashes are shown for you.
- 2Toggle the g, i, m, and s flags to control global, case-insensitive, multiline, and dotall matching.
- 3Optionally pick a preset from the Common patterns dropdown, such as Email address, URL, or IPv4 address.
- 4Paste your sample text into the Test String box — matches are highlighted instantly, with totals shown below.
- 5Review the Match Details table for each match’s position, length, and capture groups, then click Copy to grab the finished pattern with its flags.
Frequently asked questions
Which regex flavor does this tester use?
The native JavaScript (ECMAScript) regex engine built into your browser. If your pattern works here, it will behave identically in JavaScript, TypeScript, and Node.js. Most patterns also carry over to other flavors like PCRE or Python, though a few advanced features differ between engines.
What do the g, i, m, and s flags mean?
g (global) finds every match instead of stopping at the first. i (case insensitive) makes letters match regardless of case. m (multiline) makes ^ and $ match at the start and end of each line rather than the whole string. s (dotall) lets the dot character match newlines too.
Does the tester show capture groups?
Yes. The Match Details table lists every capture group for each match, numbered $1, $2, and so on, alongside the match’s index and length — handy when you are building a replacement string or extracting parts of the text.
Are there ready-made patterns I can start from?
Yes — the Common patterns dropdown includes tested expressions for email addresses, URLs, E.164 phone numbers, IPv4 addresses, dates in YYYY-MM-DD format, and hex color codes. Select one to load it into the pattern field, then tweak it for your use case.
Is my test data sent anywhere?
No. Matching happens entirely in your browser — neither your pattern nor your test string ever leaves your device, so it is safe to paste logs, customer data samples, or proprietary text.
Is this regex tester free?
Yes — completely free, with no sign-up, no limits on pattern complexity, and no restrictions on how much text you test.
Enjoying this tool?
Toolism is free and always will be. If it saved you time, consider buying me a coffee!
Buy me a coffee