Regex Tester — Test Regular Expressions Online
Test regex patterns against strings instantly — see all matches, positions, and counts. Free, browser-only.
Test String
Matches
What is a Regex Tester?
If you've ever stared at a regex like /[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}/gi and wondered what it actually matches — you're in the right place. A regex tester lets you write a regular expression and instantly see every match, its index position, and the total match count against any string you provide. This tool uses the browser's built-in JavaScript RegExp engine, which supports ECMAScript regex syntax including lookaheads, lookbehinds, named groups, and the unicode flag. Nothing you type is ever sent to a server.
Regular expressions are powerful patterns used in almost every programming language for searching, validating, and transforming text. A live tester makes it much easier to build and debug complex patterns. Check the regex tutorial at regular-expressions.info for a solid reference.
How to Use the Regex Tester
Enter a Pattern
Type your regular expression into the Pattern field. You do not need to include surrounding slashes.
Set Flags
Enter flags in the Flags field (e.g. gi for global, case-insensitive). Common flags: g global, i case-insensitive, m multiline, s dot-all.
Type Your Test String
Type or paste the text you want to test in the Test String editor. Matches appear instantly in the output panel.
Example
Here is a classic example matching email addresses:
Matching email addresses
Pattern: [a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,} Flags: gi
Output:
Frequently Asked Questions
What regex flavour does this tool use?
This tool uses the JavaScript RegExp engine, which follows the ECMAScript specification. It supports lookaheads, lookbehinds, named capture groups, and the u (unicode) and s (dotAll) flags.
What does the "g" flag do?
The g (global) flag makes the engine find all matches in the string instead of stopping after the first one. Without it, only the first match is returned. Combine with i for case-insensitive matching.
Is my data sent to a server?
No. All matching runs entirely in your browser using the built-in JavaScript regex engine. Nothing is ever transmitted — safe for sensitive data.
How do I match across multiple lines?
Use the m (multiline) flag so ^ and $ match the start and end of each line, not just the whole string. Use the s (dotAll) flag to make . match newlines too.
What are named capture groups?
Named groups let you label parts of a match with a name: (?<year>\d{4}). They're supported in the JS RegExp engine and described in the MDN named capturing group docs.
Related Tools
See also: JSON Validator, JSON Formatter.