Regex find and replace
Use regular expressions to find and replace patterns in any text. Type your regex in the find field and a replacement string in the replace field. The match count updates live and the output pane shows the result instantly. Supports capture groups in the replacement string ($1, $2, etc.). All processing runs locally in your browser.
Input text
Result
FIND & REPLACE
How it works
In plain mode, the search text is escaped and matched literally using a JavaScript RegExp with the global flag. In regex mode, the pattern is used as-is. The case-insensitive flag is added unless Case sensitive is enabled. The whole-word option wraps the pattern in word boundaries (\b). String.replace() with the RegExp applies the substitution across the entire input on every keystroke. All processing runs in JavaScript in your browser.
Processing runs in your browser
All processing happens locally in your browser tab. Our servers are not involved at any point.
Related operations
For more advanced pattern matching, try the regex tester. To alphabetise or dedupe the result, use sort lines. For comparing two versions of the text side by side, see text diff.
Frequently asked questions
- How do I use capture groups in the replacement?
- In regex mode, you can reference capture groups from your pattern using $1, $2, etc. in the replacement field. For example, to swap 'first last' to 'last, first': pattern (\w+) (\w+), replacement $2, $1.
- What regex flavor does this tool use?
- This tool uses JavaScript's built-in RegExp, which is based on the ECMAScript standard. It supports most common regex syntax including character classes, quantifiers, groups, lookahead, and lookbehind (in modern browsers).
- What does the 'g' flag do?
- The global flag (g) replaces all matches in the text. Without it, only the first match is replaced. This tool always applies the global flag in regex mode so all occurrences are replaced.
- Is my data sent to a server?
- All text processing runs locally in your browser. No data is sent to our servers.