inyourbrowser.com

Regex Replace Tool

Use a regular expression to find every match in your text and substitute it with another string. Capture group references ($1, $2) and the whole-match marker ($&) are fully supported. All processing runs in your browser using the native RegExp engine.

//
Test string
REPLACE WITH
Result
Enter a pattern and test string above

MODE

Runs entirely in your browser

How it works

The tool uses the browser's native JavaScript RegExp engine. Patterns are compiled with new RegExp(pattern, flags) and results are computed synchronously. Invalid patterns show an error badge, they never crash the page.

Processing runs in your browser

Both the pattern and the test string are processed entirely in your browser. Our servers are not involved at any point.

Related operations

For plain substring swaps without regex, try find and replace. To validate JSON patterns you are matching, use the JSON formatter. For decoding escape sequences in HTML attribute values, see HTML entities.

Frequently asked questions

How do I reference a capture group in the replacement?
Use $1, $2, and so on to reference the first, second, and subsequent capture groups. Use $& to insert the entire match, $` for the text before the match, and $' for the text after.
Does the global flag affect replacements?
Yes. With the g flag every match is replaced. Without it, only the first match in the input is replaced. Use the i flag to make matching case-insensitive.
Can I delete all matches?
Yes. Leave the replacement field empty and add the g flag. Every match is replaced with an empty string, effectively deleting all occurrences.
Is my text sent to a server?
All processing runs in your browser using the native JavaScript RegExp engine. Our servers are not involved at any point.

Related tools

Text diff
Inline or side-by-side comparison. Handles plain text and structured diffs.
Case converter
Convert text between camelCase, snake_case, kebab-case, PascalCase and more.
URL encode / decode
Percent-encode and decode URLs, or parse query strings into key-value pairs.
Find & replace
Find and replace text with plain search or regular expressions. Supports case-sensitive and whole-word matching.