What is inside
Every match is painted onto your text in alternating grey tones, and listed with its number, line and column, index, length and text. Empty matches show as a marked position instead of vanishing.
Each match gets a column per numbered group ($1, $2) and one per named group (the name in angle brackets). A group that did not take part shows as undefined, not as an empty string, because they are different things in JavaScript.
Type a replacement using $1, $<name>, $&, $` , $' and $$ and read the exact output on your whole text before it touches a file. Copy the result with one button.
See the pieces the pattern produces as a separator, including captured groups, which JavaScript keeps in the output. Splitting identifiers like parseHttpResponseCode at case changes is one of the library patterns.
Write one case per line, + if the pattern should match it and - if it should not. The tab shows pass or FAIL per case and a total, and updates as you edit the pattern. This is how you keep a pattern honest after you tweak it.
The pattern is read left to right and described in plain words with nesting shown by indentation: classes, ranges, quantifiers (greedy or lazy), anchors, groups, lookahead and lookbehind, backreferences and unicode escapes.
Matching runs in a background worker with a 1.5 second limit. A pattern like (a+)+$ on a long run of a is stopped with a message naming the likely cause, and the page stays usable.
Copy equivalent code for JavaScript, Python, Java or PHP. Copy a share link that carries the pattern, flags and up to 4,000 characters of text; the page warns you it contains your text, and nothing is shared unless you press the button. Save the last 12 patterns in this browser. Download everything as JSON.
Worked examples
Pattern ^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2}) \[(\w+)\] (.*)$ with g and m on two log lines gives two matches. The first starts at index 0 with groups 2026-11-29, 09:00:01, INFO, started. The second starts at index 35 with 2026-11-29, 09:00:02, WARN, slow query. The "Log line" library entry loads this with its sample.
Pattern (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) and replacement $<day>/$<month>/$<year> turns "Invoice 1042 was issued 2026-11-02" into "Invoice 1042 was issued 02/11/2026". This is the tool's default example, so you can see it the moment you open it.
\b(\w+)\s+\1\b with g and i on "This is is a test of the the backreference." finds "is is" at index 5 and "the the" at index 21. The \1 repeats whatever group 1 matched.
(?<=[a-z])(?=[A-Z]) is a zero-width match. In the Split tab, parseHttpResponseCode becomes parse, Http, Response, Code. Lookbehind needs a modern browser; the tool warns you about older Safari.
(a+)+$ against forty a characters followed by an exclamation mark makes a backtracking engine try an exponential number of ways to fail. The tool stops it after 1.5 seconds and says so. a+$ says the same thing without nested repeats and returns at once.
For ^[a-z0-9]+(?:-[a-z0-9]+)*$ write + good-slug, + also-ok-2, - Bad_Slug, - -nope. All four cases pass. Loosen the pattern later and any case that flips turns red.
Reference
| Flag | Name | What it changes here |
|---|---|---|
| g | global | Find every match. Without it you get the first match only. |
| i | ignore case | Letters match either case. |
| m | multiline | ^ and $ match at each line, not only the start and end of the text. |
| s | dotAll | The dot also matches line breaks. |
| u | unicode | Treats the pattern and text as unicode code points and enables \p{...} properties. |
| y | sticky | Matches only at the position where the previous match ended. |
| Token | Inserts |
|---|---|
| $1 to $99 | The text captured by that numbered group. |
| $<name> | The text captured by the named group. |
| $& | The whole match. |
| $` | The text before the match. |
| $' | The text after the match. |
| $$ | A literal dollar sign. |
JavaScript rejects or misreads these. The tool shows a note instead of leaving you with a silent mismatch.
| You typed | The note says |
|---|---|
| (?>...) | Atomic groups are not supported by JavaScript. |
| a++ or a*+ | Possessive quantifiers are not supported by JavaScript. |
| (?i) | Inline flags are not supported. Use the flag switches. |
| \A \Z \z | Not supported. Use ^ and $ with the m flag. |
| \h | Not supported. Use [ \t]. |
| (?P<name>...) | Python-style named groups are not JavaScript syntax. Use (?<name>...). |
| \K, (?R), (?( | Not supported by JavaScript. |
| [[:alpha:]] | POSIX classes are not supported. Use [A-Za-z]. |
| (?<=...) | Works in current browsers; Safari before 16.4 does not support lookbehind. |
How to use it well
Step 1
Paste real text, not a toy line. Edge cases live in real data: blank lines, trailing spaces, odd punctuation.
Step 2
Start small and broad, then tighten. Watch which matches disappear as you add constraints. Turn on "Show whitespace" when a match looks right but is off by an invisible character.
Step 3
Write cases for what must not match. Most bad patterns match too much, and a - case catches that.
Step 4
Read the Explain tab. If a token is described differently from what you meant, that is the bug.
Step 5
Check the runtime. Pick the language in the Code tab and test in that runtime, because lookbehind, unicode and \b differ between engines.
Step 6
Before you ship a pattern that runs on user input, try it on a long near-miss string. If the tool stops it, rewrite it without nested repeats.
What it cannot do
Matching uses your browser's JavaScript engine, so results are exactly what browser and Node code will do. It does not run PCRE, Python, Go, Java or .NET engines. The Code tab translates the pattern text and flags mechanically and says so in a comment at the top of each snippet. For the 24 library samples the Python and Java snippets find the same number of matches as JavaScript. The PHP snippet is not verified, and your own patterns can still behave differently, so test in the target runtime.
It tells you a pattern ran too long, not which branch backtracked.
The guard is a time limit on your actual text. A pattern that is fast on your sample but slow on another input can still pass here.
Matching stops at 3,000 matches, the table lists the first 300, split shows up to 500 pieces, saved history keeps 12 entries, and share links and saved entries keep up to 4,000 characters of test text.
It does not predict what a pattern will match, and it does not cover every rare construct. If a construct is not recognized it is shown as a literal character.
Saved history lives in this browser's local storage and is gone if you clear site data. A share link contains your test text in the address, so anyone who has the link can read it.
What it does
Free JavaScript regex tester: live match highlighting with line and column, named-group tables, replace and split preview, pass/fail test cases, token-by-token explanation, a timeout against runaway patterns, code export and 24 starter patterns. It runs in your browser.
| Function | What it does here |
|---|---|
| JavaScript engine results | Yes, your own browser engine |
| Other engines (PCRE2, Python, Go, Java, .NET, Rust) | No, code translation only |
| Highlighting, groups, replace, split | Yes |
| Pass and fail cases | Yes, line-based |
| Step-through debugger | No |
| Runaway-pattern protection | Time limit (1.5 s) on your text |
| Works with no account, nothing stored remotely | Yes |
| Share | Link that holds your text in the address |
Reading the result
Shows the match count with your pattern and flags, for example "3 matches for /(?
Under the highlighted text: how many matches, how many characters they cover, and how long the search took in milliseconds. A slow time on a short text can be a sign of a pattern that backtracks.
"4 of 4 cases pass" counts your own pass and fail cases. A passing set only covers the cases you wrote, so add the awkward input you are afraid of.
Each tab reuses the same pattern and flags. Replace and Split show what your pattern does to the text. Explain reads it token by token. Code writes it for other languages with the dialect caveat on that tab.
Common mistakes
<.+> on <a><b> matches the whole 6 characters as one match. <.+?> matches <a> and <b> separately. If a match swallows too much, try the lazy form.
Without g, \d on "1 2 3" finds one match. With g it finds three. The g button is on by default, so if you see only one match, check whether it was switched off.
(?P<name>...) from Python, inline flags like (?i), and possessive quantifiers like a++ are not JavaScript. The tool shows the engine error and a warning that names the JavaScript form to use instead.
(a+)+$ against 40 letters a and an exclamation mark makes the engine retry an enormous number of paths. The tool stops after 1.5 seconds and says the pattern probably backtracks catastrophically, instead of freezing the page.
(?<=\$)\d+ works in current browsers. Safari before 16.4 does not support lookbehind, and the tool warns you to check the runtime you will ship to.
The share link contains your pattern, flags and up to 4,000 characters of your test text, readable by anyone with the link. The tool says so before it copies the link. Use example text for anything you will share.
Questions
No. Matching runs in a worker inside your browser tab. The page makes no request with your text. Closing the tab clears it unless you saved to history or copied a share link.
It ran longer than 1.5 seconds on your text. Nested repeats such as (a+)+ or (.*)* are the usual cause. Rewrite so each character can only be matched one way.
In JavaScript an optional group that did not participate returns undefined, which is not the same as an empty string. The table shows the difference.
Look at the note under the pattern. It names the unsupported construct and the JavaScript way to write it, where there is one.
Replace in this tool replaces every match. Split always splits at every separator. The g flag controls the Matches tab.
Nothing, and there is no account.
Your data
The tool runs in this browser tab. It does not need a server to do its job. Your pattern and test text stay in the page. Nothing is copied, downloaded or shared unless you press the button for it.
Keep going
Regex Workshop
Test regular expressions with live highlighting, capture groups and replace previews.



