2

Let's say I want to highlight/search all the lines in a file opened with vim with following criteria.

Criteria: Lines which start with "start123" and end with "321end". There could be anything between these two patterns.

I tried following but no luck.

/^start123\&321end$

Ofcourse I can do this on bash with grep -G '^start123' teest|grep -G '321end$' But I want to highlight this strings in vim. Just wondering.

10

Just match anything (.*) between the start and end patterns:

/^start123.*321end$
  • Perfect. I was close it means.. – Milind Dumbare Mar 24 '15 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.