Fun with IP address parsing
I maintain a JavaScript library that does exactly this (called ip-address). Unit tests are very important for handling the esoteric formats, though there are a couple that were new to me in David's post.One of my motivations for writing the library was being able to grep for IPv6 addresses in text files; it's surprisingly difficult to match all valid representations of a simple IPv6 address as seen in the example here:https://twitter.com/beaugunderson/status/527393872909828096I also maintain a site for examining IPv6 addresses that may be useful to people working with IPv6:http://v6decode.com/