Regex Find & Replace
Find and replace text using regular expressions with live preview, capture group references, and common presets. All processing happens in your browser — nothing is sent to a server.
/
/
$1
$2
$3
$&
$`
$'
\\n
\\t
0 matches
Enter a pattern and source text to see live preview...
Before
After
- No replacements yet. Run a replacement to see history.
Replacement String Reference
| Token | Description | Example |
|---|---|---|
$1, $2, ... | Captured group by number | Pattern (\w+)-(\w+), replace $2_$1 |
$& | Entire matched substring | Wrap match: [$&] |
$` | Text before the match | Duplicate prefix |
$' | Text after the match | Duplicate suffix |
$$ | Literal dollar sign | Price: $$$1 |
Regex Quick Reference
| Token | Description |
|---|---|
. | Any character except newline |
\d | Digit [0-9] |
\w | Word character [a-zA-Z0-9_] |
\s | Whitespace |
* | 0 or more |
+ | 1 or more |
? | 0 or 1 (also: non-greedy modifier) |
{n,m} | Between n and m times |
^ / $ | Start / end of string (or line with m flag) |
(abc) | Capture group |
(?:abc) | Non-capturing group |
[abc] | Character class |
a|b | Alternation (a or b) |
(?=abc) | Positive lookahead |
(?<=abc) | Positive lookbehind |