Special Processing: Search and Replace a String

Special Processing: Search and Replace a String

 

You can swap out a piece of text within a single file or set of files with this special process. Simply choose the file(s) to process, what text string to search for and what to replace with.

In order to specify multiple files to be searched, place the folder name in the Original File location, followed by a wildcard and the file type. For example, C:\TestFolder\*.doc will cause every .doc file within the TestFolder to be searched for the specified string. If a single file is to be searched, simply specify the individual file name, e.g., C:\TestFolder\OneFile.doc.

 

Replacements may be made to the original file or placed in another file. If the replacement(s) are to be made in the original file, simply use the same file name in path in both the the Original File and Target File locations. Otherwise a different target filename may be specified and another file, implementing the replacement(s), will be created. Note that if the specified target file already exists it will be replaced.

 

Special Control Characters

Below the search and replacement text boxes are ASCII char specification list boxes. You can use ASCII characters to indicate symbols and control characters that otherwise can’t be shown in your search and/or replacement strings. For example, if you want to search for a string that includes a return ("enter"), you would select the ASCII character [10]LF from the ASCII char list box. It will display in your string as ©10©. To create a replacement string that reads ‘1. First item.’ where the 1. is followed by a tab, select [9]TAB to place ©9© into your string. The entire replacement string will appear as ‘1.©9©First item.’

 

Note: Although you will search for an "enter" with the ASCII linefeed character only ([10]LF), if you want to place an "enter" into the replacement string you must combine the two ASCII characters [13]CR and [10]LF. For example, if you wanted to add returns after each word in the search string ‘this is a string’, your replacement string would look like ‘this ©13© ©10©is ©13© ©10©a ©13© ©10©string’ where the ASCII characters have been selected from the ASCII char listbox.

 

Another useful ASCII character is [32]SPACE.

 

Case Sensitivity

You can specify whether or not you want the search to be case sensitive. When not case sensitive, all instances of the search string will be replaced when the corresponding letters are found, whether uppercase or lowercase.

NOTE: THE FOLLOWING OPTIONS ARE NOT AVAILABLE FOR ALL FILE TYPES

 

Use Regular Expressions

For text files (UNICODE OR ANSI) you can also specify whether or not you want to use regular expressions. Regular expressions allow you to use generalizations when describing what to search for. For example, you could specify to search and replace all words that begin with the letter "h". "hello", "happy" etc. would both replaced in this case. NOTE: you can also do a search and replace on RTF files provided you specify the input file type as text, not RTF. See the link below for additional reference information on the regular expression engine used:

 

www.softinterface.com/FAQ/FAQ-Regular-Expressions.htm

 

Whole Word Only

If the search item has blank or invisible text before and after it, then it will be marked as a match. This is also true if punctuation characters are found before and after the search item.

 

Do not match if found at BEGINNING of line

A match will occur only if the text found is not at the very beginning of a line of text.

 

Do not match if found at END of line

A match will occur only if the text found is not at the very end of a line of text.

 

Mulit-Line Expression

Search across multiple lines of text.

 

Generate A Report When Done

If you want a summary of those items that matched during the search, enable this option and specify a report file.