Help Start | Home | Finders Keepers

Replacement Expressions

Replacement expressions are very simple formulas that enable you to construct replacements that include any part or all of the text that was found during a Replace operation.

Regular expressions entered in Find in the Main Window are independent of what you enter in Replace. But replacement expressions, entered in Replace in the Main Window, are completely dependent on what you enter in Find. Replacement expressions refer to one or more parts, or all, of the regular expression in Find.

For replacement expressions to work at all, the regular expression in Find must have pairs of curly brackets { } enclosing the sub-expressions or the complete expression. The enclosed sub-expressions may be referenced sequentially, left to right, as \1, \2, and so on, up to \9. For example, given a regular expression in Find of {whale}{[']?[s]?}, a replacement expression in Replace of white whale\2 will replace occurrences of “whale”, “whales”, and “whale’s” with “white whale”, “white whales”, and “white whale’s”, respectively.

Replacement Expression Symbols

Symbol Description
& Put an ampersand into your replacement expression to insert all the matched text into the replacement text at the position of the ampersand.

\0 A backslash zero has the same effect as an ampersand.

\1 .. \9 Put a backslash number , for example, \1, \2, \3, corresponding to a sub-expression in your regular-expression Find, into your replacement expression to insert the sub-expression’s matched text. The number must be between 1 and 9 to refer to a sub-expression.

See: Replacement Expression Examples