How to query lines with "string2" inside files with "string1"

Good question! I tried a few that I thought would work and didn’t get the results I imagined I would. I am definitely going to try to sit down and figure this out tomorrow because assumed this would have been pretty easy to accomplish in ways similar to the ones you showed.

In the meantime, one workaround would be to use the following regular expression as a search:

/string1.*string2|string2.*string1/

It isn’t going to bring you right to the line you want, but the line you want will be at the beginning or end of the matched text. I am new to regex so this might not even work the way I think, if at all, but it might be a start.

I look forward to seeing how this can be accomplished in a more elegant way.

Good luck! Thanks!

4 Likes