Tuesday, October 7, 2014

Regular Expressions: How to restrict match extension to the first occurrence?

Dear Vim experts,

consider the following line

glm::something mlg::else

The goal is to match the words before and including the double colons. Of course

/\([a-zA-Z]\+::\)

does the job. But the question arose, if

/\<.\+::

could be restricted to match

glm::something

and not

glm::something mlg::

- So I guess my question is, is there a way to tell vim to please not
extend the matched region to be as large as possible, but e.g. take
the smallest possible match?

Of course I browsed the documentation and asked the most popular
search machine. I might have overlooked the answer.

Help will be much appreciated.
Have a pleasant day and
Cheers!

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: