Writing

Loopback Address

A loopback address is a reserved IP address that sends outgoing signals back to the same computer for testing.

IPv4

127.0.0.1 though it is often represented as localhost.

IPv6

0000:0000:0000:0000:0000:0000:0000:0001 and its permutations.

Regex

A good regex to filter those loopback addresses out:

  ^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$

Source