Tuesday, December 10, 2013

Re: Selecting an IPv4-address?

On 2013-12-10 14:13, Niels Kobschätzki wrote:
> Hi,
>
> I have a short question. What is the fastest way to select an
> IPv4-address like 192.168.1.100 for copy/cut&paste?

If you want to get really fancy, you could do something like

:nnoremap <leader>ip w?\%(\d\{1,3}\.\)\{3}\d\{1,3}?e<cr>v??<cr>

The only edge case I know of is if the IP address falls at the end of
the file.

It does select semi-bogus IP addresses since the regexp is lax (so it
could find 999.888.777.666 which is invalid), but that could be
tightened up if needed.

-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

---
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/groups/opt_out.

No comments: