Regex Tester
Test regular expressions against sample text with live match highlighting and group capture.
Matching runs locally using the browser's built-in RegExp engine, so neither your pattern nor your test string is ever sent to a server.
Regex Tester
Test a pattern against sample text with live match highlighting and group capture.
Flags
Quick patterns
Why Test a Pattern Instead of Just Reading It
Regex is dense enough that most mistakes are invisible on a read-through. A greedy quantifier that grabs more than intended, a capture group that silently stops participating in one branch of an alternation, a flag that changes how ^ and $ behave, none of these show up as a syntax error. The pattern compiles fine and runs fine. It just matches the wrong thing, or the right thing in the wrong places, and the only reliable way to catch that before it ships is to run it against real sample text and look at exactly what got captured.
That is what this tool is for: type a pattern, paste in text that looks like what you will actually be matching against in production, and see every match highlighted along with its numbered and named capture groups. If the highlighted spans do not line up with what you expected, that gap is the bug, and it is much faster to spot visually than to trace through the pattern character by character.
The flag toggles map directly to JavaScript's actual RegExp flags: g finds every match instead of stopping at the first, i ignores case, m makes ^ and $ match line boundaries instead of only the start and end of the whole string, s lets . match newlines, u switches to Unicode code-point semantics, and y forces the match to start exactly at the current position. Toggling them here and watching the highlighted matches change is a faster way to build an intuition for what each one actually does than reading documentation.
Common Use Cases
Validating a pattern before it ships
Paste in a handful of realistic examples, including edge cases like empty strings or unexpected whitespace, and confirm the pattern matches exactly what it should and nothing else.
Debugging why a pattern isn't matching
When a regex silently fails in application code, pasting the same pattern and input here shows immediately whether the problem is the pattern, the flags, or the input itself.
Extracting structured data with capture groups
Numbered and named capture groups are listed under each match, which makes it easy to confirm a pattern is pulling out the right pieces before wiring it into parsing code.
Building a find-and-replace pattern
Replace mode shows the exact output of a group-reference replacement ($1, $2, or $<name>) against your test string, before you paste the same pattern into a script or editor.
Frequently Asked Questions
Is my pattern or test string sent to a server?
No. Matching runs entirely in your browser using JavaScript's built-in RegExp engine. Nothing you type here is transmitted anywhere.
Why does my pattern only match once until I turn on the "g" flag?
Without the global flag, RegExp.exec stops after the first match, which is the actual behavior of regex in JavaScript, not a limitation of this tool. Turning on "g" finds every match in the test string.
What is the difference between the "s" flag and the "m" flag?
"m" (multiline) makes ^ and $ match the start and end of each line instead of only the whole string. "s" (dot all) makes . also match newline characters, which it does not by default. They are independent and commonly confused.
Why does my replacement show $1 or $<name> literally instead of substituting the group?
Group references only substitute when the pattern actually captured that group on a given match. Check that your pattern has a capturing group (not a non-capturing (?:...) group) at that position, and that the group is not inside a branch of the pattern that did not participate in the match.
Further Reading
Related Tools
GUID / UUID Generator
Generate UUID v1, v4, and v5 identifiers, in bulk.
Encrypt / Decrypt
AES encryption, SHA/MD5 hashing, Base64, Hex, ROT13.
Password Generator
Generate strong, random passwords.
JSON Formatter
Format, validate, and beautify JSON.
JWT Decoder
Decode and verify JSON Web Tokens.
Timestamp Converter
Convert Unix timestamps, ISO 8601, and human-readable dates.