Categories


Popular topics

Shortcut: Ctrl+R
Ultraedit replace.png

The replace dialog allows you to search for a specific text string and replace it with a different text string.

Enter the string to search for in the Find what field, and the replace string to be used in the Replace with field. Both of these fields support single or multi-line strings up to 20,000 bytes.

If the string is not found, the search wraps around to the other end of the file and continues the search. To configure this behavior, see the Settings » Search » Miscellaneous help topic.

If the string doesn't exist in the file, UltraEdit will prompt you.

In addition to regular characters and strings, both the Find what and Replace with fields support searching for several special characters and strings with special notation. For example, "^t" will match a tab (or insert a tab if part of the Replace with string). For a complete list of these values, see Special search characters. These special characters are valuable for matching non-printable text in files.

Ultraedit find i history.png
History button

This button displays a scrollable history list for either Find what or Replace with.

Ultraedit find i favorites.png
Favorites button

This button opens the Find what or Replace with favorites menu with the following options:

Add to Favorites adds current item in "Find what" field to Favorites list
Edit Favorites opens Edit Find/Replace Favorites dialog where you can name favorite search strings, organize the list and remove items from the list
Favorites opens sub-menu to select an existing favorite for the "Find what" string
Ultraedit find i regexp.png
Regular expressions help button

This button opens a short regular expression syntax reference for the selected regular expression engine. This button is subdued unless the regular expressions checkbox is checked.

Ultraedit find i swap.png
Swap button

This button swaps the contents of the Find what and Replace with fields.

Next
(Note: This button will be labeled "Start" if Show slim dialog after start is not enabled in Settings under Settings » Search » Miscellaneous - by default, it is not.) Clicking the Next button initiates a search for the string in the Find What field. If the string is not found from the caret position to the end of the file, then the search wraps around to the top of the file and continues the search with a brief notification displayed at the lower-right of the editor window. To configure this behavior, see the Settings » Search » Miscellaneous help topic.

If the string doesn't exist in the file, UltraEdit will prompt you.

If Show slim dialog after start is enabled in Settings under Settings » Search » Miscellaneous (by default, it is not), then UltraEdit will highlight the first match and open the slim replace dialog. Otherwise, the Replace dialog will remain open.

Once UltraEdit highlights a match, the Replace (or slim replace) dialog offers the following options:

Find next
Moves to the next match of the Find what string without making a replacement.

Replace
Replaces the currently selected match and moves to the next match.

Replace all
Replaces all matches in the file.

Last (slim replace dialog only)
Replaces the currently selected match and closes the slim replace dialog.

Close
Closes the slim replace dialog

In
You can set the search area to Current file, Selected text or All open files here. If you select All open files, pressing Next will automatically move focus to the first match in the next open file.

Note: If Set 'Find/Replace where' to 'Selected text' if more than one line selected is enabled in Settings under Settings » Search » Auto reset settings(it is, by default), then the In setting will automatically be set to Selected text if the selection contains more than one line and at least one non-whitespace character.

Ultraedit find i options.png
Advanced options button

This button expands the advanced search options which are covered below.

Advanced search options[edit]

Match whole word
This option forces the search to match whole words only. This is useful, for example, if you only want to replace 'a', or 'A' without replacing 'a' that occurs as part of a larger word.

Match case
This option forces the search to match the case of the 'Find what string exactl.y This option applies to regular expressions as well.

Regular expressions
This option enables the use of regular expressions for both the Find what and Replace with strings. There are 3 different types of regular expressions available:

For information regarding creation of regular expressions see the Regular expressions or Perl regular expressions topic.

Preserve case
This options forces the search to match the case of the Replace with string with the case of the matched string. The rules for this are as follows:

  1. If the word found is all lowercase the replacement word will be all lowercase
  2. If the word found is all UPPERCASE the replacement word will be all UPPERCASE
  3. If the word found is MixedCase the replacement word will match the MixedCase of the replacement word

For example, with this option selected, and Find what set to "The" and Replace with set to "Then":

  • "the" will be replaced with "then"
  • "THE" will be replaced with "THEN"
  • "The" will be replaced with "Then"

The mixed case scenario requires the Replace with string to have the same number of uppercase characters as its match so that UltraEdit knows where the (matching) mixed case letters are. For example, a replace consisting of "SomeString" for Find what and "FooBar" for Replace with would result in the following matches / replacements:

  • "somestring" would be replaced with "foobar"
  • "SOMESTRING" would be replaced with "FOOBAR"
  • "SomeString" would be replaced with "FooBar"
  • "SOMEstring" would be replaced with "FooBar" (case is not preserved, as the number of uppercase characters are not equal between the match and replacement)

Replace all is from top of file
If checked, the replace will always run from the top of the active file rather than the caret position.

Close after replace all
This option closes the Replace dialog after a successful Replace all in which there was at least 1 replacement.

In column
This option restricts the replace to the user-specified start and end columns. The number entered for the end column must be greater than the number entered for the start column (except when searching an entire line). To search an entire line, use "0" and "-1". Note that column numbering begins with "0" so the initial column value would have to be set to "0" to search from the beginning of a line.