Regex Tester
Free online regex tester and debugger. Highlight matches live, inspect capture groups, run substitutions, and test JavaScript regex flags. 100% private.
Common patterns
Matches 0
| # | Match | Index | Length |
|---|---|---|---|
| No matches | |||
Free online regex tester and debugger. Highlight matches live, inspect capture groups, run substitutions, and test JavaScript regex flags. 100% private.
| # | Match | Index | Length |
|---|---|---|---|
| No matches | |||
Type your regular expression into the pattern field and choose the flags you need (global, ignore case, multiline, dotall, unicode, sticky) with the toggle buttons.
Paste or type your test string into the text area. Matches are highlighted in real time as you type, with alternating colors so adjacent matches stay distinct.
Read the match table below β it lists each match number, its index, length, and every capture group in its own column, including named groups.
Open the Substitution panel and enter a replacement string (supporting $1, $<name>, and $& tokens) to preview the rewritten output instantly.
Every match is highlighted directly over your test string as you type, debounced for smooth performance. Adjacent matches alternate color so you can tell where one ends and the next begins.
The result table adds a column for each capture group your pattern defines, including named groups via (?<name>β¦). Unmatched optional groups are shown explicitly so you can debug alternations.
Enter a replacement string and see the substituted output update instantly. Standard replacement tokens β $1 backreferences, $<name> named groups, $& for the whole match, and $$ for a literal dollar β are all supported.
Toggle the g, i, m, s, u, and y flags individually and watch the results change. The active flags are shown next to your pattern exactly as they would appear in a /pattern/flags literal.
Your pattern and test data are evaluated entirely in your browser using the native JavaScript engine. Nothing is ever transmitted, unlike tools that send your input to a backend for processing.
Unlike popular online regex tools that send your expression and test text to their servers, this tester runs everything in your browser with the native RegExp engine. Sensitive log samples, user data, or proprietary patterns never leave your device, and no account is required.
Beyond a simple match/no-match, you get the exact index and length of every match plus a dedicated column for each capture group. Named groups appear by name. This is the level of detail you need to fix a stubborn alternation or a greedy quantifier.
Because the tool uses the browser's own JavaScript regex engine, the behavior you see is exactly what your Node.js or front-end code will produce β including flag semantics like dotall (s) and sticky (y). No surprises between testing and production.
When a pattern is invalid, the tool shows the browser's native error message verbatim β the same message your code would throw β with no invented or misleading extra text. You learn to read real regex errors, not a tool's paraphrase.
A regular expression is a compact pattern language for describing sets of strings. Instead of writing procedural code to scan text character by character, you declare a pattern and let the engine find every substring that fits. Regular expressions power search-and-replace, input validation, log parsing, syntax highlighting, and tokenization. In JavaScript they are first-class objects created with a literal like /\d+/g or with the RegExp constructor.
This tester uses the browser's own engine, so what you see is exactly what your application code will do with the same pattern, flags, and input.
/abc/i matches "ABC".^ and $ match the start and end of each line, not just the whole string.. match newline characters, which it does not by default.\p{L}.Parentheses create capture groups, numbered left to right by their opening bracket. The pattern (\w+)@(\w+) captures the local part and domain of a simple address into groups 1 and 2. Named groups, written (?<year>\d{4}), let you reference captures by name instead of position, which keeps complex patterns readable. Non-capturing groups (?:β¦) group without consuming a numbered slot, which matters when you only need grouping for an alternation or quantifier.
In replacements you reference captures with $1, $2, or $<name>. The token $& inserts the whole match, and $$ inserts a literal dollar sign. The Substitution panel in this tool previews exactly how those tokens expand.
By default, quantifiers like *, +, and {2,} are greedy: they match as much as possible, then backtrack if needed. Appending ? makes them lazy, matching as little as possible. The classic trap is <.*> against <a><b>, which greedily matches the whole string in one go. The lazy version <.*?> matches each tag separately. Watching the highlight update as you add the ? makes the difference obvious.
\., \+, \(. An unescaped dot matches any character.(a+)+ on certain inputs can take exponential time. Prefer specific patterns and possessive-style constructs where possible./g RegExp carries lastIndex between calls, which can cause skipped matches if you reuse the same object across loops.Regular expressions excel at lexical pattern matching: extracting tokens, validating shapes, and find-and-replace. They are a poor fit for parsing recursively nested structures such as balanced parentheses, full HTML, or JSON, where a real parser is the right tool. Knowing the boundary saves hours: reach for regex on flat patterns, and switch to a parser when the grammar nests.
The most effective way to build a complex pattern is incrementally. Start with the simplest expression that matches part of your target, confirm it highlights what you expect, then add one constraint at a time. If a match disappears unexpectedly, the last token you added is the culprit β remove it and reconsider. Use the capture-group columns to verify that each group isolates the right fragment, and keep the test string varied: include the edge cases you actually care about, such as empty fields, trailing whitespace, and unexpected characters. Because every change re-runs instantly and entirely in your browser, you can iterate dozens of times in a minute without ever sending your data anywhere. This tight feedback loop, more than memorizing syntax, is what turns regex from a source of bugs into a dependable tool you reach for with confidence.
No. Both your pattern and your test string are evaluated entirely in your browser using the native JavaScript RegExp engine. Nothing is transmitted to a server, stored, or logged. You can confirm this by opening your browser's network tools and seeing that no requests fire while you type.
It uses the JavaScript (ECMAScript) regex engine built into your browser, the same one your Node.js and front-end code use. That means features like named groups, lookbehind, and the s and u flags behave exactly as they will in your application. Patterns written for PCRE or Python may differ slightly.
Every match in the result table includes a column for each capture group your pattern defines. Numbered groups appear in order, and named groups created with (?<name>β¦) are included too. If an optional group did not match, the cell shows an empty-set marker so you can spot it.
Yes. Open the Substitution panel and enter a replacement string. It supports the standard tokens: $1, $2 for numbered groups, $<name> for named groups, $& for the whole match, and $$ for a literal dollar sign. The substituted output updates live as you edit the pattern or replacement.
The tool shows the browser's native error message exactly as written β for example 'Invalid regular expression: missing )'. No extra or invented text is added, so you learn to read the same errors your code throws. The match table and highlights simply clear until the pattern is valid again.
If you are not using the global (g) flag, only the first match is found and highlighted. Toggle the g flag to find every match. Also note that overlapping matches are not possible with a single pass β the engine continues after each match, so patterns that could overlap will only show non-overlapping results.
Yes, because it relies on your browser's modern JavaScript engine. Named groups (?<name>β¦), lookahead (?=β¦), and lookbehind (?<=β¦) all work in current browsers. If you use a very old browser, some features may be unavailable, but virtually all up-to-date browsers support them.
Yes, completely free with no registration, no usage limits, and no ads injected into results. Real-time highlighting, the full match table, substitution preview, and all six flags are available at no cost. Bookmark it for quick regex debugging whenever you need it.