Prev | Next |
Find and Replace
Each of Enterprise Architect's code editors facilitates searching for and replacing terms in the editor, through the 'Find and Replace' dialog.
Access Highlight the required text string and press:
- Ctrl+F for the find controls only, or
- Ctrl+R for both find and replace controls
In each instance, the 'Find what' field is populated with the text currently selected in the editor. If no text is selected in the editor, the 'Find what' field is populated with the word at the current cursor position. If no word exists at the current cursor position, the last searched-for term is used.
Basic Operations - Commands
Command |
Action |
See also |
---|---|---|
Find Next |
Locate and highlight the next instance (relative to the current cursor position) of the text specified in the 'Find what' field. |
|
Replace |
Replace the current instance of the text specified in the 'Find what' field with the text specified in the 'Replace with' field, and then locate and highlight the next instance (relative to the current cursor position) of the text specified in the 'Find what' field. |
|
Replace All |
Automatically replace all instances of the text specified in the 'Find what' field with the text specified in the 'Replace with' field. |
Basic Operations - Options
Option |
Action |
See also |
---|---|---|
Match Case |
Specify that the case of each character in the text string in the 'Find what' field is significant when searching for matches in the code. |
|
Match whole word |
Specify that the text string in the 'Find what' field is a complete word and should not be matched with instances of the text that form part of a longer string. For example, searches for ARE should not match those letters in instances of the words AREA or ARENA. |
|
Search up |
Perform the search from the current cursor position up to the start of the file, rather than in the default direction of current cursor position to end of file. |
|
Use Regular Expressions |
Evaluate specific character sequences in the 'Find what' and 'Replace with' fields as Regular Expressions. |
Concepts
Concept |
Description |
See also |
---|---|---|
Regular Expressions |
A Regular Expression is a formal definition of a Search Pattern, which can be used to match specific characters, words or patterns of characters. For the sake of simplicity, the Code Editor's 'find and replace' mechanism supports only a subset of the standard Regular Expression grammar. Text in the 'Find what' and 'Replace with' fields is only interpreted as a Regular Expression if the 'Use Regular Expressions' checkbox is selected in the 'Find and Replace' dialog. |
|
Metasequences |
If the 'Use Regular Expressions' checkbox is selected, most characters in the 'Find what' field are treated as literals (that is, they match only themselves). The exceptions are called metasequences; each metasequence recognized in the Code Editor 'Find and Replace' dialog is described in this table:
If a single character metasequence is preceded by a backslash (\) it is treated as a literal character: c\(at\) matches c(at) as the brackets are treated literally. When the 'Use Regular Expressions' checkbox is selected, a metasequence helper menu is available to the right of both of the 'Find what' and 'Replace with' fields; selecting a metasequence from this menu inserts the metasequence into the field, replacing or wrapping the currently selected text as appropriate. |
|
Tagged Regions |
When 'find and replacing' with Regular Expressions, up to nine sections of the original term can be substituted into the replacement term. The metasequences '\(' and '\)' denote the start and the end of a tagged region; the section of the matched text that falls within the tagged region can be included in the replacement text with the metasequence '\n' (where n is the tagged region number between 1 and 9). For example: Find: \((A-Za-z) +\)'s things Replace with items that belong to \1 Original text: These are all Michael's things. Replaced text: These are all items that belong to Michael. |