How to find and replace, test a regex, and diff two texts
Choose literal replace, a JavaScript regular expression, or a line-oriented diff — all in the browser, with worked examples.
Simple, regex, and multiple replacements
Simple Replace walks the haystack with String.indexOf and splices the replacement for every non-overlapping match. A dot is a dot. “foo” in “foo foo food” becomes “bar bar bard” because “food” starts with “foo.” Match case is on by default. Whole word skips prefix hits so “foo” does not change “food.” Empty find is rejected so the loop cannot run forever. Leave replace empty to delete matches. Regex Mode uses JavaScript RegExp in this tab (character classes, capturing groups, $1). Multiple Replacements apply up to eight pairs in order — later pairs see earlier edits, so cat→dog then dog→fox turns “cat and dog” into “fox and fox.” Use Regex Tester when you want a match list without replacing. Use this page to rename a symbol, swap a domain, or run a short cleanup without an editor.
JavaScript regex in this browser
Regex Tester uses the same RegExp engine as app code in this tab. Flags may only be g, i, m, s, u, and y. If you omit g, Toolora still adds it so matchAll lists every match. Example: \b\w{3}\b on “The cat sat on the mat.” lists five three-letter words (The, cat, sat, the, mat); “on” is two letters and is skipped. Invalid patterns surface the engine error. “No matches” is a successful test with count 0. Catastrophic backtracking can freeze the tab — keep patterns simple on large haystacks. Copy matches; use Find & Replace for literal swaps afterward.
Line-oriented diff
Text Diff computes added, removed, and edited lines, then paints tokens inside a line when only part of it changed. The page matches JSON Compare: two line-numbered editors, Open/Clear, Swap, and live side-by-side, unified, or inline views — there is no Compare button. Default example: “hello world” versus “hello there” on the first line, with “keep this line” unchanged, reports added 1, removed 1, edited 1. Empty-on-both-sides is allowed on the article page so you can start from scratch; the classic execute() still asks for at least one side. Use JSON Compare when both sides are JSON documents and you want a tree. Whitespace and line endings matter.
Privacy
Haystacks, patterns, and both diff panes stay in the browser. Close the tab to discard them. Related: Slugify and case converters when you need a normalized string rather than a search-and-replace.