How this tool works
Both modes end up as a regular expression. In literal mode every character you type is escaped first, so a full stop matches a full stop and nothing else, and the replacement text is escaped too — a dollar sign stays a dollar sign rather than being read as a group reference. In regex mode your pattern is compiled as written, which gives you groups, alternation and character classes, and gives you the chance to write something invalid.
Matching is case-insensitive unless you tick the box. Scope decides whether every occurrence is replaced or only the first. The whole-word option wraps your text in word boundaries and applies to literal mode only, because in regex mode you are already able to write boundaries yourself. If the pattern does not compile, the error from the regular expression engine is shown rather than a generic failure.
Reading the result and avoiding the traps
- Two numbers are reported, and they differ on purpose: the first is how many times the text occurs anywhere in the input, the second is how many were actually changed. Replacing only the first occurrence of six matches reports six and one.
- Whole word uses word boundaries, not spaces: a boundary sits between a letter or digit and anything else, so hyphenated and apostrophised words split at the punctuation, and an underscore counts as part of the word.
- Dollar signs are safe in literal mode: prices and variable names are replaced exactly as typed. In regex mode the same text is a group reference, so use it deliberately or escape it.
- The original is never modified: the input stays where it is and the result is shown separately, so an over-eager pattern costs you nothing but another run.