Regex Tester
Try a pattern against real text and see exactly what it catches — and what it misses.
What this tool does
Regex Tester compiles the pattern you type using the browser's own RegExp constructor, then runs it across the text in the input box. You write the pattern on its own, without the slashes around it, and the flags are checkboxes rather than letters on the end, so g, i, m, s and u are each set deliberately. A pattern the engine refuses is reported as a notice carrying the engine's own words — "Unterminated group", say — rather than quietly matching nothing, although the result pane goes on showing the last successful run until you correct the pattern and press Run again.
The result pane hands your text back with every match wrapped in a highlight, which is the fastest way to see the misses as well as the hits: a pattern that catches four of the five lines you expected makes that obvious at a glance. Copying the output gives a different view — a numbered list of matches, each with the position it began at and the contents of its capture groups, with named groups printed alongside. Fill in the replacement field and the rewritten text is appended to that list, so $1, $2 and
lt;name> can be checked before the expression goes anywhere near a real file.Three things are worth weighing before you lean on a run. The first is the flavour: this is the JavaScript engine, so a pattern lifted from Perl, PHP or Python may behave differently or refuse to compile — inline flags such as (?i), atomic groups, possessive quantifiers, recursion and POSIX classes like [:alpha:] are not part of it, and the sticky and indices flags are not offered here at all. The second is that matching runs on the page's own thread with no time limit, so an expression that backtracks catastrophically against a long string will freeze the tab until you reload it. The third is a ceiling: scanning stops after 5,000 matches, which the summary states outright. None of this leaves the machine — pattern and text are handled by the tab you are reading, and neither is sent onwards.
How to use it
- Paste the text to run against. Use a sample of the real thing — log lines, a spreadsheet column, an email body. Load sample fills the box with two names, two email addresses and three dates if you only want to try the tool out.
- Type the pattern. Top field of the settings panel, JavaScript syntax, no slashes. It starts on (\w+)@([\w.]+), which splits an email address into two capture groups.
- Choose the flags. g finds every match and is on by default; switch it off and only the first is reported. i ignores case, m makes ^ and $ meet each line, s lets the dot cross newlines, and u turns on Unicode mode for escapes like \p{L}.
- Read the highlights. Matches appear marked in place in the text. The line beneath counts them, adding the number of capture groups when the pattern has any, and repeats the pattern with its flags back at you when nothing matched.
- Copy the list, or preview a replacement. Copy output gives you the numbered matches with their offsets and groups. Adding a replacement appends the rewritten text underneath it.
Processing & privacy
Runs on your device. Your file is processed directly in this browser.
Common use cases
Checking a validation rule before it ships
Paste the awkward inputs — a plus sign in an address, a trailing space, an accented name — and watch which of them the pattern lets through.
Pulling fields out of log lines
Wrap the timestamp and the status code in capture groups, then read them back from the copied list instead of counting characters by hand.
Drafting a search and replace before you run it
Test the substitution here with $1 and $2 in place, then take the working expression to your editor or to Find and Replace.
Working out why a rule never fires
A pattern match that works in one place and not another is usually a flag: case sensitivity, or ^ anchoring to the whole text rather than to each line.
Questions
Does the text I paste in leave the tab?
Which regex flavour is this?
Why did the count stop at 5,000?
Can a pattern lock up the page?
What is the number next to each match?
Why does an empty match repeat over and over?
Does the replacement alter my text?
Related tools
- JSON Formatter — Pretty-print, collapse and inspect JSON instantly.
- Base64 Encoder Decoder — Encode and decode Base64 text and files.
- JWT Decoder — Inspect the header, payload and claims of a JWT.
- Hash Generator — Compute MD5, SHA-1, SHA-256 and SHA-512 digests.
- Unix Timestamp Converter — Convert between epoch seconds and readable dates.
- QR Code Generator — Create a QR code for a link, text, Wi-Fi or vCard.