Finding and Replacing Within Scripts

The Script Editor Find and Replace function enables you to search scripts for strings, punctuation marks, and numbers. You can conduct partial-word and whole-word searches, apply case-sensitive constraints, and replace individual or multiple occurrences of your search item.

Table 221. Find/Replace Definitions

Field

Definition

Find What

Enter the search criteria—a string, punctuation mark, or number. If you do not stipulate whole word, the search criteria acts as a prefix. That is, “report” matches “reporting,” “reporter” and “reported.” Wildcard characters cannot be used.

Replace With

Enter the replacement text.

Match Whole Word

Instructs the Find/Replace feature to match only the entire text that matches exactly your search criteria. For example, “report” matches only “report”. It does not match “reports” “reporting”, “reporter” and “re-ported.”

Match Case

Instructs the Find/Replace feature to match only the text that matches the case of your search criteria. For example, if you specify “Chart,” the found words must match “Chart” with a capital C.

Direction

Specify the direction from which to conduct the search, upward or downward. By default, the direction is downward.

Replace

Specify whether to replace, as indicated.

ReplaceAll

Specify whether to replace of all occurrences.

Close

Close the Find/Replace window.

Note:

In JavaScript version 1.4, if a regular expression starts with ‘|’ , this character is treated as a vertical bar and not an alternate regexp metacharacter. For example, the regular expression “|aaa” matches the string “bbb|aaa” starting at the fourth position, and it does not match the string “aaabbb”. In JavaScript verion 1.5, the ‘|’ character is treated (when not quoted) as an alternate metacharacter . In this case, the regular expression “|aaa” means “empty string OR ‘aaa’”. For example “|aaa” matches the string “bbb|aaa” starting before the first character (and the matched string is empty). The same occurs with “aaabbb”. It matches the empty alternative before the first character. To make an older “|aaa” regular expression work in JavaScript 1.5, place quotes around the | character with a backslash.. For example, enter “|aaa” as “\|aaa”, or “|Target~”. In JS1.5 as “\|Target~”. Also note the JavaScript version 1.4 behavior not only occurs when ‘|’ is located at beginning of whole regular expression, but also at the beginning of regexp group. For example, you would need to change the regular expression “aaa(|bbb)” to “aaa(\|bbb)”. See http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference.

Note:

When the Find/Replace feature finishes its search, the message "Reached the end of the script. All instances of search item replaced" or “Reached the end of the script. Cannot find Search item” is displayed.