Wednesday, April 27, 2011

Re: arithmetic expressions in search

On Apr 27, 3:36 am, "John Beckett" <johnb.beck...@gmail.com> wrote:
> googler wrote:
> > I have a file where I have words like X1, X2, ..., X16, X17, X18, ....
> > I want to find out occurences of words containing a number
> > greater than, say, 17. So basically, I want to find X18, X19,
> > X20, etc. How can I do this in vim? In other words, can we
> > use arithmetic expressions in search? If yes, how?
>
> I believe there is no way to search for a number depending on an
> expression. You would have to do it manually, something like
> this simple effort:
>
> /X1[89]\|X[2-9][0-9]
>
> John

Thanks for the reply. But it may not always be simple like you showed
above. For example, if I wanted to only search for those numbers that
are divisible by 7. If such a feature is currently not available in
vim, it maybe a good idea to add it? Just a suggestion..

--
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

No comments: