Easiest way to grep IPv6 / shortest regex that matches IPv6 (invalid address not a big deal)

I want to grep IPv6 addresess from log files that only contain valid IPv6 addresses that someone connected from (and also contains lines with IPv4 and many other lines without any IP, eg. /var/log/secure).

Therefore it's not so important for this regex to match only true RFC valid IPv6 such as massive regexes from do, but it should match everything that somewhat resembles IPv6 so that it doesn't provide too many false positives and should be as short as possible, so that it's easy to remember and type this.

3 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like