Find and replace looks like a 5-second feature, until you’re trying to swap variable names in a project and something subtle breaks. Plain string replace, the kind every text editor offers, will happily change userId to accountId inside mainUserIdValidator — turning it into mainAccountIdValidator. The fix is almost always one of: whole-word matching, case sensitivity, or a regex.
This tool gives you all three options in one place, runs entirely in your browser, and shows you the match positions before you commit to the replacement. You see what’s about to change before it changes.
How it works
Internally, every search is normalized to a JavaScript regular expression. Plain text is escaped so metacharacters like . and * are treated literally. Whole-word wraps the pattern in \b...\b (word boundaries). Case-insensitive adds the i flag. Multiline adds m (only relevant in regex mode, for ^ and $).
Match positions are recorded with line and column numbers so you can scan them in the preview list. Replacement happens after all matches are collected, walking from the end of the input backwards so earlier match positions stay valid.
Regex replacement strings
In regex mode, the replacement supports the standard JavaScript substitution tokens:
$1,$2, … — the corresponding capture group$&— the whole match$$— a literal$
For example, swapping the order of two words: find (\w+) (\w+) with replacement $2 $1 turns hello world into world hello.
In plain mode, all $ characters in the replacement are escaped — so you can paste $300,000 as a replacement without it trying to back-reference a non-existent group.
Example: renaming a variable safely
You want to rename userId to accountId in a 2000-line file. A naive plain replace would also catch mainUserIdValidator and userIds. Turn on whole word: only standalone occurrences match. Result: userId becomes accountId, but userIds (plural, no boundary after) and mainUserIdValidator (no boundary before) are left alone.
If you also need to catch userid and UserId, turn on case-insensitive. The whole-word constraint still applies.
Example: extracting and reformatting data
You have a list of Name <email@example.com> strings and want them as email@example.com (Name). Turn on regex mode. Find: (\w+) <([^>]+)>. Replace with: $2 ($1). Each line’s name and email are captured into groups 1 and 2, then reordered in the replacement.
Common mistakes
Plain mode $ confusion. If you type $1 as a plain replacement and expect a back-reference, you’ll get the literal text $1. Switch to regex mode for back-references; the plain-mode escape is intentional so you can replace text containing $ symbols.
Whole-word with non-word characters in the find pattern. \b is a zero-width assertion at a transition between word and non-word characters. If your find pattern starts or ends with a non-word character (a space, a slash, a punctuation mark), the whole-word option may not behave the way you expect — \b won’t fire next to those characters because they’re already non-word. Drop whole-word for those cases.
Multiline confusion. Multiline only changes what ^ and $ mean in regex mode — they become per-line anchors instead of input start/end. The . metacharacter is unaffected; it still doesn’t match newlines without the s (dotAll) flag, which this tool doesn’t expose. Use [\s\S] if you need a “any character including newline” pattern.
Catastrophic backtracking. A regex like (a+)+b against aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa! can take seconds to fail. The 5000-match cap saves you from runaway match counts, but it doesn’t save you from a single match that takes forever to fail. If the page seems to hang, tighten the pattern (e.g. a+b instead of (a+)+b).
What this tool does not do
It doesn’t preserve case during replacement (no smart-case substitution where Foo→Bar and foo→bar happen in one pass). For that, you need separate runs.
It doesn’t work line-by-line; the entire input is treated as one string. Per-line transforms are better handled by the sort lines tool or by writing a regex anchored with multiline ^/$.
It doesn’t preview replacement diffs side-by-side — the result is shown in full, not as a diff against the source. For visual side-by-side comparison, use the text diff tool.