Regex tester
Test regular expressions and see matches in real time
Pattern must be in /pattern/flags format — flags are optional (e.g. /\d+/g).
This tool runs entirely in your browser. Your pattern and test string are never uploaded or sent to a server.
0 matches
About this tool
Regular expressions are powerful tools for pattern matching and text manipulation, but their syntax is terse and easy to get wrong. Testing a regex against sample data before deploying it saves hours of debugging. This tool lets you write a regex pattern, provide test strings, and instantly see which parts match, whether your pattern is valid, and how many matches were found — all in real-time as you type.
Common uses
- › Testing regex patterns before including them in code
- › Debugging why a pattern isn't matching expected strings
- › Developing and refining email, URL, or format validation patterns
- › Extracting or validating data with complex patterns
- › Learning regex syntax interactively by testing examples
Example
Pattern: /\d{3}-\d{4}/g\nTest string: Call 555-1234 or 555-5678
Match 1: 555-1234 (position 5)
Match 2: 555-5678 (position 18)
Technical notes
- › This tool uses JavaScript's regex engine (ECMAScript). Some syntax differs from other engines like PCRE (used in PHP/Perl) or Python's re module — for example, named group syntax and lookbehind support vary by engine and version.
- › The g (global) flag is required to find all matches; without it, only the first match is returned.
- › The i flag makes matching case-insensitive, m makes ^ and $ match line boundaries within a multi-line string, and s makes . match newline characters.
FAQ
Why isn't my pattern matching anything?
Common causes are a missing g flag (only the first match is found without it), unescaped special characters, or a pattern that's valid syntax but doesn't actually match your test string's format.
What's the difference between the flags g, i, m, and s?
g finds all matches instead of just the first, i ignores case, m makes ^/$ match the start/end of each line rather than the whole string, and s makes . also match newlines.
Will this regex work the same in my programming language?
Mostly, since most languages share similar core regex syntax, but engines differ on details like lookbehind support, named groups, and Unicode handling — always test in your target language before relying on it.