(Created page with "Category:Home tab right Replace in files allows you to search for and replace a string in multiple files in a location of your cho...") |
(No difference)
|
Replace in files allows you to search for and replace a string in multiple files in a location of your choosing. The files don't have to be open in UltraEdit while the search runs. When the search completes, UltraEdit will prompt you with the number of replacements and the number of files changed by the operation. Please note: replace in files will make the replacements to files directly on the hard drive, therefore this operation is irreversible!
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.
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.
You can specify the search location(s) in the Directory field. This field may contain multiple search paths separated by semicolons, i.e.: C:\mydir1\; c:\mydir2\.
Click the active file directory button to set the Directory field to the active file's parent directory. Click the ... button to open a folder browser where you can browse to and select your target search directory.
The In files/types field allows you to restrict the search to particular file types by extension. For example, to search only HTML and CSS files, you would use: *.html;*.css. If left empty, all files are searched.
Use the In setting to set the search area to one of the following:
Note: to do a replace in all open files, use the regular Replace dialog with In set to Open files.
History button
This button displays a scrollable history list for either Find what or Replace with.
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 |
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.
Swap button
This button swaps the contents of the Find what and Replace with fields.
Start
Invokes an interactive replace in files, where for each match, you'll see a prompt with options for each file where a match exists. This prompt includes the following buttons:
Replace all
Begins the replace in files search with a prompt for confirmation. All replacements are done automatically and immediately to any matched file(s).
Advanced options button
This button expands the advanced search options which are covered below.
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 exactly. 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:
For example, with this option selected, and Find what set to "The" and Replace with set to "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:
Search subdirectories
By default, only files in the top level of the search directory are searched. If this option is checked, all subfolders of the Directory field search location will be searched, not just the top level files.
Ignore hidden subdirectories
If this option is checked (along with search subdirectories), then OS-level hidden subfolders are not searched.
List changed files
If checked, this option will output a list of each file changed by the replace in the output window, followed by the number of replacements in the file.
Open matching files
This option will open all files containing a match.
Subdirectories to ignore in search
You can exclude certain subdirectories by entering them here. For example, if you want to exclude any folder named ".git," simply type .git into this field. Separate multiple items with a semicolon, for example, .git;cvs.
File names/extensions to ignore in search
You can exclude file types or names from the search by entering them here. For example, if you want to exclude from the search all files with an extension of ".bak", simply type *.bak into this field. Or if you wish to exclude all files with names beginning with the string "index," you could type index* here (the asterisk acts as a wildcard). Separate multiple items with a semicolon.
Use encoding
Check this box to manually specify an encoding type UltraEdit should assume when opening files to search them. If this option is left unchecked (recommended), the search will use the default OS encoding for searching files unless a BOM is detected, in which case the encoding signaled by the BOM is used. If this option is checked, the options for are as follows:
Please keep in mind that if an incorrect encoding is used for find in files, search results may be inaccurate or incomplete.
See also: