Skip to content

Instantly share code, notes, and snippets.

@rickhull
Created June 18, 2013 02:34
Show Gist options
  • Save rickhull/82780f59b77b92a9e06a to your computer and use it in GitHub Desktop.
Save rickhull/82780f59b77b92a9e06a to your computer and use it in GitHub Desktop.
IP_REGEX = /
\A # starts with
\d+ # some digits, iface number
\:\s # colon literal followed by a space
(\S+) # some non-whitespace, iface name, $1
\s+ # some spaces
inet\s # inet (v4) designation
([\d\.\/]+) # start IPv4/CIDR capture
/x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment