Search in vim for string starting and ending with a pattern

vim

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.

Best Answer

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

/^start123.*321end$
Related Question