Regex Tester

Runs in your browser, nothing is uploaded. Your input is saved in the page link.

Test JavaScript regular expressions with live highlighting, capture groups, replacement, and a plain-English explanation.

Loading tool…

About this tool

Type a pattern and some test text to see every match highlighted as you type, with positions and capture groups listed below. Turn on replace mode to preview a substitution using $1, $<name>, and $&. The explanation breaks the pattern into pieces and says what each one does. Matching uses your browser’s JavaScript regular expression engine, and runs in a background worker so a runaway pattern cannot freeze the page.

Questions

Which regex flavor is this?

JavaScript (ECMAScript), exactly as your browser implements it. That is what you get in JavaScript, TypeScript, and Node.js. Other languages differ in details.

Will my Java regex work here?

Mostly, for everyday patterns. Java-only features do not exist in JavaScript: possessive quantifiers such as a++, atomic groups (?>...), \A \Z \z anchors, \h, inline flags such as (?i) at the start, and class intersections like [a-z&&[^aeiou]]. Use the flag toggles instead of inline flags, and write \d once here, not "\\d" as in a Java string literal.

What does “Timed out” mean?

The pattern took longer than two seconds. This usually means catastrophic backtracking, which happens with nested quantifiers such as (a+)+ on text that almost matches. Simplify the pattern, make quantifiers more specific, or shorten the text.

Why do I see empty matches?

Patterns that can match nothing, such as x* or ^, match at every position where they can. They show as thin red markers in the highlighted text.

Is my text uploaded?

No. Everything runs in your browser. The pattern and text are also stored in the page URL so you can share a link, so avoid sharing links that contain sensitive data.

Keyboard shortcuts

Regex Tester

CtrlEnter
Copy the replacement result (Replace on)

Everywhere

CtrlK
Search tools and actions
/
Search tools (when not typing)
?
Show this list (when not typing)
Esc
Close a dialog or menu