On 04/27/2011 01:59 PM, ZyX wrote:
Normally you do the following: create a regular expression
that is able to find all numbers and then write additional
code which will filter the results of the first search so that
only numbers divisible by 7 are left.

I must say that there are times I've wanted an integer-range token for a regexp. It would be much easier to write something like

 /\<\%{0-255}\%(\.\%{0-255}\)\{3}\>

to search for an IPv4 address than to attempt some horrible expression which ends up looking something like


\%(0\|1\d\{,2\}\|2\d\|2[0-4]\d\|25[0-5]\|[3-9]\d\)\%(\.\%(0\|1\d\{,2\}\|2\d\|2[0-4]\d\|25[0-5]\|[3-9]\d\)\)\{3}\>

That 2nd regexp may or may not be correct as I haven't fully tested it. :)

The intent of a numeric-range is much clearer and much easier to tweak.

-tim







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

Reply via email to