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.<p>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:<p><a href="https://twitter.com/beaugunderson/status/527393872909828096" rel="nofollow">https://twitter.com/beaugunderson/status/527393872909828096</a><p>I also maintain a site for examining IPv6 addresses that may be useful to people working with IPv6:<p><a href="http://v6decode.com/" rel="nofollow">http://v6decode.com/</a>