Regex Tester
Real-time matching, groups, replace preview and a pattern library.
Matches
Match details
Match 1: support@codetools.studio @14
Groups: support, codetools.studio
Match 2: sales@codetools.studio @42
Groups: sales, codetools.studio
About Regex Tester
The Regex Tester matches a pattern against test text in real time, highlighting every match and capture group as you type. It also generates ready-to-paste code snippets so you don't have to hand-translate a working pattern into your language of choice.
How to use it
- Type your pattern into the pattern field.
- Toggle flags (like global or case-insensitive) using the buttons below it.
- Paste your test string; matches highlight live, with a running count and execution time.
- Enable Replace mode to preview a substitution using $1, $2 for capture groups.
- Use Export to copy a ready-to-use snippet in JavaScript, Python, Java, or PHP.
Common use cases
- Validating an email or phone-number pattern before shipping it
- Debugging why a regex isn't matching the input you expect
- Generating the same working pattern as code in four different languages
- Browsing the built-in pattern library to learn or reuse common regexes
Example
Before
Pattern: ^\d{3}-\d{3}-\d{4}$ Test string: 415-555-0132After
Full match: 415-555-0132
This pattern matches a US-style phone number in exactly the NNN-NNN-NNNN shape; loosen the anchors or digit groupings for other formats.
Common errors
The pattern matches part of the string when you expected a full match
Add ^ and $ anchors to require the whole string to match, not just a substring somewhere inside it.
A regex with the g flag behaves inconsistently across repeated calls
A global RegExp keeps internal state (lastIndex) between calls — reset lastIndex to 0, or avoid reusing the same RegExp object across separate test() calls.
Special characters like . or ( aren't matched literally
Escape them with a backslash — \. or \( matches the literal character instead of using its special regex meaning.
FAQ
Which regex flavor does this use?
JavaScript's native RegExp engine, since matching runs in your browser. Behavior can differ slightly from PCRE, Python's re, or other engines on edge cases like lookbehind support.
Does Replace mode actually modify my test string?
No. It shows a live preview of what the replacement would produce, using $1/$2 to reference capture groups, without altering the original test string.
Can this validate whether my regex pattern is syntactically correct?
Yes — an invalid pattern shows a clear syntax error immediately as you type, so you can use it as a quick regex validator, not just a match tester.