How can I select every N lines in visual studio code. I can't find a proper regualr expression can let me do this.
Select the lines you want and then press: Windows: Shift + Alt + i. Mac: shift + option + i.
.*
button).(.*\n){N}
into the search field, replacing N
with the number of lines to select (such as (.*\n){2}
for every second line).Select All Occurrences of find Match
from the command palette to select every Nth line..*
(^.*?$[\n]){9}
That RegExp will find [ed. but not select] 9 lines of code at a time - empty lines do count as a line.
What are you going to replace them with?
If you want to replace every nth line, like every 9th line with some new text, try this regex:
((.*\n){8})(.*\n)
and replace with $1[new line 9 stuff here]
Select Multi lines in VsCode
Visual code natively supports this functionality.
But you have to select the lines manually.
For more details:Visual Studio Code Documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With