30

I am looking for a similar way that I work in Sublime Text:

Find All for a specific regular expression. Then it has multiple-selected the texts I need.

A simple find and replace does not fulfil my needs. I need to move the cursors to some segment in the lines to edit.

I m on Windows.

1 Answer 1

53

Windows & Linux

Per an answer to this StackOverflow Question:

  • Do a normal Find ( Ctrl + F ) using regular expressions.

Visual Studio Code RegEx Find

  • Press Alt + Enter to select all the Find matches. This will insert multiple cursors at the end of each occurrence.

  • Use the Left Arrow and Right Arrow keys to move the synced cursors within each selection.

  • Edit selections as necessary.

Official Keyboard Shortcut List For Visual Studio Code On Windows
Official Keyboard Shortcut List For Visual Studio Code On Linux


macOS

  • Do a normal Find ( ⌘ Cmd + F ) using regular expressions.

  • Press ⌥ Option + Enter to select all the Find matches. This will insert multiple cursors at the end of each occurrence.

Official Keyboard Shortcut List For Visual Studio Code On macOS

5
  • 1
    Thank you so much this saved lot of my time Commented Apr 16, 2021 at 15:08
  • 1
    @MaheshJamdade You're welcome. Glad to know you found it helpful. =) Commented Apr 16, 2021 at 19:36
  • Thank you very much! Commented Jul 1, 2021 at 20:52
  • @SunitGautam You are very welcome. =) Commented Jul 2, 2021 at 7:09
  • Additionally, if you need to confine the search to a region of the file, make a selection, then hit the "bars" icon near the right of the search field to activate "Find in Selection". Commented May 1, 2023 at 13:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .