Regex Find and Replace (Online Regex Replacer)
Free online regex find-and-replace. Match with JavaScript regular expressions - groups, alternation, look-arounds - and rebuild with $1 back-references. Live match count, runs in your browser.
Regex is on, so each find pattern is a JavaScript regular expression: use groups, alternation, character classes and look-arounds, then reference captures in the replacement as $1, $2. The match count updates live, \n and \t expand in the replacement, and you can stack several patterns for a bulk pass.
How to use it
Paste your text and type a find pattern
The match count updates as you type. Toggle regex, case, whole-word or replace-all as needed.
Add more rules for a bulk pass
Click 'Add replacement' to stack extra find/replace pairs - they run in order. Use $1 back-references in regex mode; an empty replacement deletes matches.
Copy the result
Output appears in the right pane. Copy it back wherever you got the text from.
What is it?
A find-and-replace tool scans a body of text for occurrences of a pattern and substitutes each with a chosen replacement. Plain-text mode does literal string matching; regex mode interprets the pattern as a JavaScript regular expression with groups, alternation and look-arounds, and the replacement supports back-references like $1, $2. Stacking several rules turns it into a bulk transformer where each rule builds on the last.
When to use it
Renaming a variable across a code snippet; switching every 'colour' to 'color' for an American audience; running a batch of substitutions in one pass (curly quotes to straight, multiple spaces to one, several term swaps); pulling phone numbers out of free-text and normalising the format. Any one-off or bulk text transformation that's faster than opening an editor.
Common mistakes
Forgetting to escape regex metacharacters in plain-text mode - dot, parens, plus, asterisk are literal in plain-text but special in regex. Using greedy quantifiers when lazy was needed: '.*' matches as much as possible; '.*?' matches as little. Ordering bulk rules carelessly so an early rule changes text a later rule was meant to match. And not previewing match count before replacing - it's the single best sanity check.
FAQ
- Can I run multiple find-and-replace rules at once?
- Yes. Click 'Add replacement' to stack as many find/replace pairs as you need - they're applied in order, top to bottom, so each rule sees the result of the previous one. Ideal for bulk clean-ups.
- Does it support regex?
- Yes - toggle 'Regex' and each find pattern becomes a JavaScript regular expression. Capture groups are addressable in the replacement as $1, $2, etc., and alternation, character classes and look-arounds all work.
- What does 'Replace all' do?
- On (the default), every match in the text is replaced. Turn it off to replace only the first match of each rule - handy when you want to change a single occurrence.
- Can I replace with a newline or tab?
- Yes, in regex mode: type \n for a line break or \t for a tab in the replacement field and it expands to the real character. In plain-text mode the replacement is inserted literally.
- What about replacing across newlines?
- In regex mode the 's' (dotall) flag is on, so '.' matches newlines too. Whole-word mode wraps your pattern in word boundaries (\b) so 'cat' won't match inside 'category'.
- Is my text uploaded anywhere?
- No. Everything runs locally in your browser with JavaScript - your text never leaves your device, so it's safe for confidential content.
Find and Replace
Find and replace text - one rule or many, plain or regex, with a live match count.
Try it out →