Find and replace text with regex support, capture groups, whole-word matching, and case-insensitive mode. Replace all occurrences or just the first.
Options
Enter text and click Replace
The find and replace operation is a fundamental text transformation tool for programmers, copywriters, and data analysts. Whether substituting deprecated variable names in source code or reformatting data columns in large CSV exports, understanding match flags and regular expressions ensures accurate, safe replacements.
| Option | Behaviour | Example Match (cat) |
|---|---|---|
| Case Sensitive | Distinguishes uppercase and lowercase characters | Matches cat, ignores Cat or CAT |
Case Insensitive (i) | Matches regardless of casing | Matches cat, Cat, CAT, cAt |
Whole Word Only (\b) | Matches exact word boundaries | Matches cat in "a cat", ignores "catalog" or "concatenate" |
Regular Expressions (regex) | Uses syntactic pattern matching | Enables digit ranges, capture groups, and backreferences |
Regular expressions allow you to capture portions of matching text in parentheses (...) and re-inject them into the replacement string using numeric backreferences ($1, $2 in JavaScript, \1, \2 in Python).
(\d{4})-(\d{2})-(\d{2})$3/$2/$1(https?://[^\s]+)[$1]($1)([a-z])([A-Z])$1-$2 (followed by lowercasing)JavaScript
// Global case-insensitive replacement with regex
const originalText = "The Quick Brown Fox jumps over the quick dog.";
const modifiedText = originalText.replace(/quick/gi, "slow");
// Replacement with capture groups
const rawDates = "2026-09-20, 2026-12-31";
const formattedDates = rawDates.replace(/(\d{4})-(\d{2})-(\d{2})/g, "$3/$2/$1");
Python
import re
text = "Item 101: $45.00, Item 102: $99.50"
# Swap currency symbol to EUR
result = re.sub(r"\$(\d+\.\d{2})", r"β¬\1", text)
print(result)
[ \t]+$ replaced with an empty string cleans trailing space without altering indentation.\r\n replaced with \n establishes clean Linux line endings.https?://([^/:]+) with replacement $1 extracts hostnames from raw text link dumps.(\d{4})-(\d{2})-(\d{2})T.* with replacement $3/$2/$1 converts API timestamps for spreadsheets.This website and utility are provided for general informational, calculation, and educational purposes only. Always verify critical computation outputs prior to professional deployment or financial use. See our Terms of Service and Privacy Policy for full governance details.