Regex Tester
Test regular expressions live — type a pattern, toggle flags, and see every match highlighted with its index in your test string.
Debug regex without the guesswork: the tester highlights every match in your sample text, lists each match with its character index, and explains pattern errors in plain language. Flag toggles cover global, case-insensitive, multiline, and dotAll modes, plus one-click presets for email, URL, date, and hex-color patterns.
How to use this calculator
- Pick a preset or type your own pattern between the slashes.
- Toggle flags: g for all matches, i to ignore case, m for multiline, s for dotAll.
- Paste your test string into the text area.
- Read the highlighted matches and the index list below.
- Iterate until every intended match highlights and nothing unintended does.
Worked example
The email preset pattern [\w.+-]+@[\w-]+\.[\w.]+ run against "Contact joe@example.com now" finds one match — "joe@example.com" starting at index 8.
Frequently Asked Questions
How do I read the highlighted results?
Every substring your pattern matches is highlighted yellow in the test string, and the match list below shows each match's exact text plus the character index where it starts. The badge counts total matches. If nothing highlights, either the pattern found nothing or there is a syntax error, which is shown in red above the flags.
What do the g, i, m, and s flags do?
g (global) finds all matches instead of stopping at the first; i makes matching case-insensitive; m makes ^ and $ match at line boundaries instead of just the string ends; s (dotAll) lets . match newlines too. Toggle them to see how the same pattern behaves differently — a classic debugging move.
Why does my pattern say 'invalid'?
The most common causes are unbalanced parentheses or brackets, a stray backslash at the end, or a bad quantifier like *+. The tool surfaces the JavaScript engine's own error message, which usually points at the problem. Note this tester uses JavaScript regex syntax — lookbehind and some advanced features differ in other languages.
Can I test patterns for Python or other languages?
Mostly yes: the core syntax (character classes, quantifiers, groups, anchors) is shared across JavaScript, Python, Java, and most other engines. Watch out for differences in lookbehind support, named-group syntax, and flag letters. Always run a final check in your target language before shipping.
Is my test data sent anywhere?
No. Matching runs entirely in your browser's JavaScript engine — your pattern and test string never leave the page. That makes it safe for proprietary log samples or customer data you would never paste into a server-side tool.