Reputation: 133
i use a lot the feature to select text and then modify all the occurrences (ctrl+f2), but many times i need to do it but between certain lines only (ex: from line 1 to 20 of a text file), is there a way to do this? maybe with regular expressions?
Upvotes: 0
Views: 54
Reputation: 768
if you use VIM mode of vscode then its
:%s/searchstring/replacestring/gc
also you can use :h :s for more detail on substitute options as well instead of % you can use specific range, for example:
:1,20s/test/worked/g
will change every occurrence of test to worked in a file from line 1 to 20(including)
you should be able to do it using search and replace together with confirmation, just skip those you don't want, but I'm using only VIM mode so don't know exact ways without it :)
PS. you can easy get VIM extension as any other and later enable/disable as necessary.
Upvotes: 2