Search and replace with a real regex

Editor find/replace can't capture groups — swap (\d+)px to $1 pixels, flag by flag, in one pass.

Tools used in this guide

The job

Renaming keys, reformatting logs, converting units in bulk — the pattern finds the shape, the replacement reuses the captured pieces. It's the same engine as JavaScript's String.replace with capture references.

Pattern, flags, replacement

Enter the regex and flags (g/i/m/s/u/y), then the replacement using $1..$9 for groups, $& for the whole match, $$ for a literal dollar. The preview runs live with a match count.

Worked example

Pattern (\w+)@example\.com → $1@internal.example: 'alice@example.com' becomes 'alice@internal.example'. For units, (\d+)px → $1rem turns '16px' into '16rem' — the group carries the number, you write whatever surrounds it.

Where it stops

Input up to 200,000 characters; match counting is capped at 100,000. A pathological pattern (nested quantifiers on near-miss text) can still stall the tab — write the regex lazily or anchor it.