Skip to content

Finding and Replacing Text in the Editor

To find text in the editor, select Find in the Edit menu or the right-click menu of the editor, or press Ctrl+F (Cmd+F on macOS). To replace text, select Replace, or press Ctrl+R (Cmd+R on macOS).

Find opens a bar at the top of the editor. Type the text to find in the Search field. Use the buttons next to it to match the case (Match Case), match whole words (Match Word), use a regular expression (Match Regexp), search only in the selected text (Find in Selection), or highlight all matches (Mark All). The matches are highlighted as you type. To move between them, use Find Next and Find Previous, press F3 and Shift+F3, or use the Down and Up arrow keys.

Finding text in the editor

Replace adds a Replace field for the new text, with the Replace and Replace All buttons.

Replacing text in the editor

With a regular expression, you can use its groups in the replacement text: $1 is the first group, $2 the second, and so on.

For example, to qualify the column names in this statement with the table name:

SELECT
    firstname,
    lastname
FROM
    person;
  1. Select Match Regexp, and clear Match Word.
  2. In the Search field, enter ^(\s+)(\w+)(,?)$.
  3. In the Replace field, enter $1person.$2$3.
  4. Click Replace All.

The result is:

SELECT
    person.firstname,
    person.lastname
FROM
    person;