How to use this developer tool
- Paste the source text.
- Enter a pattern without slash delimiters.
- Enter the replacement string and flags.
- Preview the output and verify the replacement count before copying it.
Preview JavaScript regular-expression replacement without modifying the source box. Supply a pattern, replacement string, and flags; the result reports how many matches will be replaced and shows the complete transformed text. Numbered captures, named captures, dollar escapes, and function-free JavaScript replacement syntax behave as they do in String.replace.
The output is the exact text produced by JavaScript String.replace using the supplied pattern and replacement string.
Replacement tokens such as $&, $1, $
Pattern: (\w+), (\w+) Replacement: $2 $1 Input: Lovelace, Ada Output: Ada Lovelace
Match counting uses a cloned global expression and advances after empty matches. Replacement itself uses the exact requested flags, so omitting g changes only the first occurrence.
No replacement callback code is executed. The tool supports replacement-string tokens only.
Patterns use the JavaScript regular expression engine available in your browser.
The tool reports the JavaScript syntax error and does not process the input text.
Pathological patterns can cause catastrophic backtracking. Test untrusted patterns on small input first.
Only when the Unicode-related flag and pattern semantics call for it; otherwise JavaScript uses UTF-16 code units.
No. Matching and replacement run in the current browser tab.
| Field | Meaning |
|---|---|
| Summary | High-level processing result |
| Statistics | Counts and validation details |
| Export | Copy-ready text plus structured data when available |
Browse more tools for code formatting & regex.
Open category hub