Test JavaScript regular expressions live. See every match, capture groups, and flags. Patterns never leave your browser.
Pattern
Flags
Quick patterns
Test string
Highlighted matches
Match details (2)
Pro tip
Writing custom regex in your code? Git AutoReview reviews regex patterns for readability and common bugs like missing escapes, alongside its 20+ built-in security rules for every PR.
Type a pattern in the top input, adjust the flags, and paste text to test against below. Matches appear instantly with positions and any capture groups you defined. The whole thing runs on your machine using the browser's built-in RegExp engine — the exact same engine that will execute your regex in production JavaScript code.
Validating user input is the first common case. Before trusting an email field or a phone number, most teams run it through a pattern. Testing those patterns against real examples — including the edge cases your users will submit — is where a live tester earns its keep.
Extracting data from log files or API responses is the second. When you need the request ID out of a stack trace or the user agent out of an access log, a regex is faster than any library. A tester lets you refine the capture groups until every line returns exactly what you expect.
Debugging existing patterns is the third. When a regex that worked for months suddenly fails on a new input, pasting it here with the problematic string reveals the mismatch in seconds. No redeploy, no console.log scattering.
The six flags in JavaScript each change one behaviour. The global flag (g) returns all matches instead of stopping at the first one — most developers forget this and then wonder why their loop finds only the first result. Case insensitive (i) is obvious. Multiline (m) makes ^ and $ match at every line break, which is what you want for log parsing but not for full-string validation.
Dotall (s) lets the dot match newline characters too. Before this flag existed, developers used workarounds like [\s\S] to match anything including line breaks. Unicode (u) enables full Unicode character class matching and is required for patterns that use \p{Letter} or emoji-aware ranges. Sticky (y) is an advanced flag that matches only where the previous match ended, useful for writing custom tokenizers.
Each match shows the full matched text, its starting index in the input, and every capture group you declared with parentheses. Numbered groups (Group 1, Group 2) correspond to the order of opening parens. Named groups appear when you use the (?<name>...) syntax — useful when a pattern has many groups and positional access gets hard to read.
Forgetting to escape special characters is easily the most common bug. A literal dot needs a backslash in front of it, or it matches any character. Forgetting the global flag on a pattern meant to find all occurrences is the second most common. The third is greedy matching — .+ eats more than you want unless you use the lazy version .+?.
Patterns and test strings often contain real production data — log lines, API keys, customer identifiers. Sending that to a server-side regex tester is a privacy risk and sometimes a compliance violation. This tool does all its work in your browser, so nothing leaves your machine.
Ctrl+Enter focuses the pattern input. Ctrl+Shift+C copies the pattern with flags as a /pattern/flags literal — the same format you would paste directly into JavaScript or TypeScript code.
You write a pattern, paste some text, and the tool reports every match with positions and capture groups. It uses the browser's native JavaScript engine, so results match what you would get with string.match() in your code.
JavaScript regex via the built-in RegExp object. Same engine as Chrome, Firefox, Safari, and Node.js. If your pattern needs to work in Python, Go, or PCRE, expect small syntax differences — lookbehinds, named groups, and Unicode categories behave a little differently across engines.
Every match runs locally in your browser using native RegExp. No pattern and no test string leaves your machine. That matters when debugging regex against logs, API responses, or anything else you would not want on a server.
g finds every match instead of stopping at the first. i ignores case. m lets ^ and $ match at every line break instead of only the string boundaries. s makes . match newlines too (dotall). u enables full Unicode matching. y is sticky — matches only where the last one ended.
Three usual suspects. Missing the g flag when you expect multiple matches — without g, only the first match is returned. Escaping — a literal dot needs \\. and a backslash needs \\\\. Anchors — ^ and $ need the m flag to match line-by-line in multiline text.
Every match includes its numbered capture groups (Group 1, Group 2, etc.) and any named groups you declared with (?<name>...). The tool lists them below each match along with the exact text captured, so you can verify your groups before using match[1] or match.groups.name in code.
Yes. Both lookbehinds ((?<=...) and (?<!...)) and named capture groups ((?<name>...)) are supported by modern JavaScript engines. Safari and Node.js both ship with them by default as of 2024+. If you see a syntax error, your browser is likely outdated.
Greedy quantifiers like .+ and .* match as much as they can before backing off. Lazy quantifiers (.+?, .*?) match as little as possible. A classic bug: <.+> on "<a><b>" greedily matches the whole string, while <.+?> correctly matches just <a>.
Not yet — this release focuses on matching and capture-group inspection. If you need replace, JavaScript's string.replace() behaves identically to what you see here, so once your pattern matches correctly, dropping it into code is safe.
Ctrl+Enter focuses the pattern input. Ctrl+Shift+C copies the pattern with its flags as a /pattern/flags literal ready to paste into code. Both shortcuts work on Windows, Linux, and macOS (Cmd on Mac).
Email, URL, IPv4, UUID, ISO date, and hex color are the patterns most developers rewrite from scratch every time and get subtly wrong. One click gives you a tested version to adapt rather than reinvent.
Developer Toolkit by Git AutoReview
Free tools for developers. AI code review for teams.