Extended Replace

From TED Notepad
Revision as of 18:53, 21 June 2011 by Jsimlo (talk | contribs)
This section is up to date for TED Notepad version 6.3.1.0.
Control page Control:feature:Extended Replace

Extended Replace.. (Alt+Ctrl+R)

Searches for all occurrences of a specified Find what phrase within the selection and replaces them with Replace with phrase.

By default, the search is case insensitive. Match case option can be used to make the search case sensitive.

Whole words option can be used to restrict the search to only those matches, which start and end at word boundaries. Note that a match itself might contain non-word characters, since only the boundaries of the match are probed. Therefore, the last character before the match and the first character after the match may not be word characters; while the first character and the last character of the match must be word characters.

RegExps option can be used to turn the Regular expressions engine on. When Regular expressions are enabled, Find what is parsed as a regular expression pattern. See chapter Regular expressions for more details on supported regular expressions syntax.

Note: Invalid or faulty patterns result in tool refusing to work until the pattern is corrected.

Mimic case option can be used to mimic character case of matches upon replacing. This option individually converts character case of the replacement string upon each match. The conversion is done upon actual replacing (i.e. after the replacement string is prepared for the match) and the conversion takes only character case of the match into account. Therefore, the mimic case may result in different character case for each match. If the tool cannot decide how to mimic case of a match, it leaves the replacement intact, giving the user a chance to specify one special mixed case replacement.

Tip: The mimic case option recognizes only basic types of character case, i.e. lower case, upper case, word capitals, first capitals. Everyting else is considered mixed case and the tool does not try to convert case of the replacement. This can be utilized to specify one mixed case version of the replacement. Consider you need to replace OneHalf with SlovakBomber, but want to use the mimic case to automatically replace onehalf with slovakbomber and ONEHALF with SLOVAKBOMBER. Using mixed case SlovakBomber as a replacement will do the trick.

Escape \ button can be used to automatically escape all back-slashes in both Find what and Replace with edit fields.

UnEscape \ button can be used to remove all escapes from both Find what and Replace with edit fields.

Note: Newlines and Tab characters can be used in Find what and Replace with fields freely. Moreover, each newline from the Find what field matches any kind of newline in the document (Win/Unix/Mac). Each newline from the Replace with field is converted to the current newline type (as shown in the Status Bar for example) upon replacing.

Note: This tool is prefered to the standard Replace All mechanism from the Find Bar in many cases. Its search is done in more feasible way and the replacing routine works much faster and uses less resources. Furthermore, the selection ensures, that the replacing is done only in the desired part of the text. And finally, one Undo step covers all replacements together, instead of grouping many small separate replacements. Although this may not be directly apparent, it is incomparably better to have one big Undo step instead of too many small Undo steps. On the other hand, if you expect only a handful of matches and replacements in a big big document, the old good looping Replace All routine might come more handy.