Sublime Forum

Is there a way to extend a selection to a searched string?

#1

I have a big file, and I want to select a big subset of lines. In other editors, I’ve been able to search for the start of the big subset I want, and then when I search for the end of the subset, there’s an option called “Extend selection” that selects all text between the current selection and the string that ends the block.

I’d also like to be able to do this with a “goto line number”, so that if there’s not a unique string to search for, I can specify the end of the subset with a line number.

I don’t see this capability documented anywhere.

Thanks in advance for any help with this. Not sure if this should be a “general discussion” or a request for a new feature.

0 Likes

#2

https://packagecontrol.io/packages/SelectUntil
Is this what you want?

0 Likes

#3

Thanks for the pointer!

It’s almost what I want.

The thing that’s missing is the ability to extend until a specific line number.

If I know the starting and ending line numbers in the file I want to select, I may not know the character count between the two points, unless there’s another tool that does this.

I could use a variety of tools to do this, but it’s time consuming.

It would be nice to have a quick and easy way to do it in the editor.

0 Likes

#4

With SelectUntil it works, just search for /(.*\n){numberofline}/

1 Like

#5

Christophe: thanks for the suggestion; it’s close enough to what I’m looking for. I just have to compute what numberofline is.

Thanks again for pointing me to the SelectUntil package, Jack.

I installed the package control and the SelectUntil package, and using the RE Christophe suggested, I was able to carve up my file into the smaller parts I wanted.

0 Likes