Finding and Replacing Text in the Editor
The Edit main menu and the editor right-click menu contain two choices for finding text (Find and Find with Dialog) and one choice for replacing text (Replace).
- Find displays a Quick Find field where you can type text to look for, and use the Up and Down keys (and F3 and Shift-F3, by default) to find the next or previous occurrence. Use the Escape key to close the field.
- Find with Dialog shows a dialog where you can enter what to look for, either as text, a regular expression or using wildcards. You can also limit the search to the current selection and use other options for a more precise search. You can use Find Next and Find Previous to navigate to other matches, by default mapped to the F3 and Shift-F3 keys.
- When using a regular expression or wildcards, the button next to the expression opens a helper menu with common symbols.
- Replace shows a dialog identical to Find with Dialog but with an additional field for entering the replacement text.
- When using a regular expression , the button next to the expression opens a helper menu with common symbols.
- When you use a regular expression with group expressions in the Find what field, you can reference the captured text in the Replace with field using the dollar sign ($) plus the group number (e.g.
$1
for the first group).
Regular Expression Example:
Text in editor:
SELECT
firstname,
lastname
FROM
person;
Find what:
^(\s+)(\w+)(,?)$
Replace with:
$1person.$2$3
Deselect Match whole word, select Entire scope and Use Regular Expression.
When you click Find and choose All in the following dialog, you get the following result:
Resulting text:
SELECT
person.firstname,
person.lastname
FROM
person;