Find & Replace Pane
The Find & Replace Pane (screenshot below; see User Interface for its location) enables you to search for text strings in all pages of design or in the current page. The search scope includes XPath expressions and XPath function names, variable names and values, control names and properties, and actions and action groups. You can also replace all instances of the found text string and use regular expression to find text.
Searching for text
To search for text in the design, do the following:
1.In the Find What entry field (see screenshot above), enter the string to find, or use the dropdown list to select a string from one of the last 10 strings. You can also use regular expressions (explained below) to find text.
2.Optionally, narrow or expand the search by, respectively, selecting or deselecting the Match whole word and/or Match case options. If Match whole word is selected, then only the exact words in the text will be matched. For example, if the search term is fit, then only the word fit will be matched; the fit in fitness, for example, will not be matched.
3.Select the scope of the search by toggling on/off the options in the Find Options combo box. You can restrict the search to the current page, and include XPath functions and/or action groups in the search.
4.Click Find or press Enter.
Results of the search
There are nine Result tabs (see screenshot below). Results are displayed in the currently selected Result tab (and overwrite any previous results in that tab). You can switch to a new tab if you want to keep a previous result.
Result tabs provide the following functionality:
•Each instance of a found search term is displayed on a separate line and contains links to the relevant design objects. For example, in the screenshot above, the instance that is highlighted refers to an instance of the search term Selection in an XPath expression that is defined for an Open URL action of a Button control. Clicking the three links take you, respectively, from left, to the action definition, the button control in the design, the XPath expression of the action.
•You can use the Copy icons in the toolbar of the Results tab (see screenshot above) to copy the following to the clipboard: (i) the selected result, (ii) the selected result and its children, (iii) all results.
•The Results tab has its own Find function, which enables you to search the results for a term. Click the Find icon in the toolbar to do this. Navigate these results with the Find Previous and Find Next icons.
•The Clear icon of the Results tab toolbar clears all the results in the current tab.
Replacing text
To replace the search term in the found instances with another text string, enter the new string in the Replace With text box and click Replace. Note that a Replace action might not work if the replaced text causes invalidity, for example, when a replacement in an XPath expression invalidates the expression, or when a replaced style value is not a valid value.
Using regular expressions
You can use regular expressions (regex) to find a text string. To do this, first, switch the Regular expression option on (see Searching for text above). This specifies that the text in the search term field is to be evaluated as a regular expression. Next, enter the regular expression in the search term field. For a brief description of regular expression metacharacters, see the section Regular expression metacharacters below.
Regular expression metacharacters
Given below is a list of regular expression metacharacters.
. | Matches any character. This is a placeholder for a single character. |
( | Marks the start of a tagged expression. |
) | Marks the end of a tagged expression. |
(abc) | The ( and ) metacharacters mark the start and end of a tagged expression. Tagged expressions may be useful when you need to tag ("remember") a matched region for the purpose of referring to it later (back-reference). Up to nine expressions can be tagged (and then back-referenced later, either in the Find or Replace field).
For example, (the) \1 matches the string the the. This expression can be literally explained as follows: match the string "the" (and remember it as a tagged region), followed by a space character, followed by a back-reference to the tagged region matched previously. |
\n | Where n is a variable that can take integer values from 1 through 9. The expression refers to the first through ninth tagged region when replacing. For example, if the find string is Fred([1-9])XXX and the replace string is Sam\1YYY, this means that in the find string there is one tagged expression that is (implicitly) indexed with the number 1; in the replace string, the tagged expression is referenced with \1. If the find-replace command is applied to Fred2XXX, it would generate Sam2YYY. |
\< | Matches the start of a word. |
\> | Matches the end of a word. |
\x | Allows you to use a character x, which would otherwise have a special meaning. For example, \[ would be interpreted as [ and not as the start of a character set. |
[...] | Indicates a set of characters. For example, [abc] means any of the characters a, b or c. You can also use ranges: for example [a-z] for any lower case character. |
[^...] | The complement of the characters in the set. For example, [^A-Za-z] means any character except an alphabetic character. |
^ | Matches the start of a line (unless used inside a set, see above). |
$ | Matches the end of a line. Example: A+$ to find one or more A's at end of line. |
* | Matches 0 or more times. For example, Sa*m matches Sm, Sam, Saam, Saaam and so on. |
+ | Matches 1 or more times. For example, Sa+m matches Sam, Saam, Saaam and so on. |
Representation of special characters
Note the following expressions.
\r | Carriage Return (CR). You can use either CR (\r) or LF (\n) to find or create a new line |
\n | Line Feed (LF). You can use either CR (\r) or LF (\n) to find or create a new line |
\t | Tab character |
\\ | Use this to escape characters that appear in regex expression, for example: \\\n |