Find and Replace guide
Replace the first or every occurrence of literal text, or use a JavaScript regular expression for structured transformations.
What this tool does
Find and Replace takes source text, a search value, and replacement text. Literal mode escapes regular-expression symbols so characters such as periods, brackets, and question marks are treated as ordinary text. You can make matching case-sensitive and choose whether to replace only the first match or every match.
Regular-expression mode treats the search field as a JavaScript pattern. It supports capture references such as $1 in the replacement value. The tool reports invalid patterns instead of changing the source. All matching and replacement happens only after you select the action, and the original editor remains available for comparison.
The replacement counter shows how many matches were changed. A valid operation can report zero when the search value is not present under the chosen case and pattern settings.
How to use it
- Paste or enter the source text.
- Enter the literal text to find and its replacement.
- Choose case sensitivity and whether to replace every match.
- Enable regular-expression mode only when pattern syntax is required.
- Select Replace text, inspect the result, and copy it when correct.
For important content, first test a narrow phrase and retain the original. Regular expressions can match more text than expected, especially when they include broad wildcards or optional groups.
Benefits
- Separates safe literal matching from pattern matching
- Supports first-match and replace-all workflows
- Offers optional case sensitivity
- Supports JavaScript capture-group replacements
- Keeps source and updated text in the browser
Regular-expression guidance
In regular-expression mode, do not add surrounding slash characters. Enter \btool\b, not /\btool\b/g; the interface applies global behavior through the Replace every match option. Case sensitivity is controlled separately.
Capture groups allow structured reordering. A pattern such as (\w+),\s+(\w+) with replacement $2 $1 can change a simple Last, First value. Real names and complex data can contain punctuation and formats that this simplified example does not cover.
JavaScript replacement syntax also assigns special meaning to dollar sequences. Review the output carefully when the replacement contains dollar signs. Very complex patterns can perform poorly on large text, so use focused expressions and split oversized documents into manageable sections.