Regex Find and Replace
Search and replace with full regex support. Capture groups, flags, and optional case preservation.
RegexCapture groupsPreserve caseFree to use
Flags
How to use
- Enter pattern and replacement. Use $1, $2 for capture groups.
- Pick flags. Global, case-insensitive, etc.
- Copy the result. Match count shown.
Common use cases
- Bulk renaming across text
- Cleaning log lines
- Template substitution
Frequently asked questions
- How do I use plain text find and replace instead of regex?
- Toggle the Plain text (literal) checkbox. The pattern will be escaped and matched literally, so special regex characters (. * + ? etc.) are treated as ordinary characters.
- How do I reference capture groups in the replacement?
- Use $1 for the first group, $2 for the second, and so on (matching JavaScript RegExp.prototype.replace). $& inserts the entire match. $<name> inserts a named capture group.
- What does Preserve case do?
- When enabled, the replacement adopts the casing of each match. ALL CAPS matches stay all caps, Title Case stays Title Case, lowercase stays lowercase. Useful for changing terminology in a document without messing up sentence boundaries.
- Why do I see fewer matches than I expect?
- Without the g flag, only the first match is replaced. Toggle g (global) on to replace every occurrence. The match counter at the top reports the actual number of replacements that happened.
- Is anything sent to a server?
- No. Find and replace runs in your browser using the native JavaScript RegExp engine; the input never leaves your device.
Related tools
How to use
- Enter pattern and replacement. Use $1, $2 for capture groups.
- Pick flags. Global, case-insensitive, etc.
- Copy the result. Match count shown.
Common use cases
- Bulk renaming across text
- Cleaning log lines
- Template substitution
Frequently asked questions
- How do I use plain text find and replace instead of regex?
- Toggle the Plain text (literal) checkbox. The pattern will be escaped and matched literally, so special regex characters (. * + ? etc.) are treated as ordinary characters.
- How do I reference capture groups in the replacement?
- Use $1 for the first group, $2 for the second, and so on (matching JavaScript RegExp.prototype.replace). $& inserts the entire match. $<name> inserts a named capture group.
- What does Preserve case do?
- When enabled, the replacement adopts the casing of each match. ALL CAPS matches stay all caps, Title Case stays Title Case, lowercase stays lowercase. Useful for changing terminology in a document without messing up sentence boundaries.
- Why do I see fewer matches than I expect?
- Without the g flag, only the first match is replaced. Toggle g (global) on to replace every occurrence. The match counter at the top reports the actual number of replacements that happened.
- Is anything sent to a server?
- No. Find and replace runs in your browser using the native JavaScript RegExp engine; the input never leaves your device.