Find and Replace Examples

To find all occurrences of the text ‘blue’ we might use this command:

Find All 'blue'

We could also use the Find command, but add the ‘all’ option:

Find 'blue', 'a'

To find all capitalized occurrences of the word, the command must be case sensitive. To do that the case insensitive option ‘i’ must be removed:

Find All 'Blue', '-i'

To find the word only in headers/footers, the where options string must exclude all other content types and then add the ‘h’ content type:

Find All 'Blue', '-i', '-ah'

Any command argument can be a variable and could be derived from another command, eg:

$word = Prompt Input 'What word would you like to find?'

Find All $word

When using PowerFind mode (option ‘e’), one can include PowerFind bubbles in the expression:

Find '(?:\b\w+\b)', 'e'

It is important to remember, especially for PowerFind Pro expressions, that string literals undergo interpolation (see Literals) before being used by the find commands. For example, the following commands are not the same:

Find '\s+', 'E'

Find "\s+", 'E'

The first finds one or more whitespace characters, as you might expect. The second however searches for one or more of the letter ‘s’ because the backslash is first interpreted using the rules for string literals. If double-quotes are to be used the backslash must be escaped like so:

Find "\\s+", 'E'

Because of this it is recommended that you use single-quotes for find command arguments.


Previous Chapter
Find and Replace
<<  index  >>
 
Next Chapter
Find Results Lists