I know in visual studio code you can select a keyword (e.g. "bob") and press Command+Shift+L to select all instances of it. But what if I currently have two different keywords selected with the alt key (e.g. "bob" and "alice"), Command+Shift+L only selects all "bob" or all "alice". How do I get all instances of both selected in this case? Is regex the only way?
Question posted in Visual Studio Code
View the official documentation.
View the official documentation.
2
Answers
Yes regex is the way.
.*
buttonb(bob|alice)b
Alt+Enter
There is an easy way to do that with an extension I wrote, Find and Transform. Make this keybinding in your
keybindings.json
:When using the extension with no arguments, like
find
,replace
, etc. it will automatically find all matches of any selected terms or pieces of text – it doesn’t matter how many there are.You don’t even need to select the whole word, a cursor in a word will select that whole word and any other matches.