iMapper Community

Rich Brown

A Regular Expression for IPv6 Addresses

IPv6 addresses are considerably more complicated to parse than the more familiar IPv4 address. Consequently, it's useful to have a standard tool for determining whether they are correctly formatted or well-formed.

A while back, Stephen Ryan from Dartware created a regular expression (regex) for validating whether IPv6 addresses are well-formed. We posted the regex as an article A Regular Expression for IPv6 Addresses in the InterMapper Knowledgebase.

We subsequently received a contribution from "Aeron" with a different regex that pointed out a bug in our earlier one. We have updated the InterMapper Knowledgebase to include the corrected version of Stephen's regex as well as Aeron's expression. Both these regular expresssions and a program to run through test cases are implemented in the Perl language.

We recently received a note from Christoph Petschnig who has translated the regex to the Ruby programming language. His version can be found on his GIT repository at http://gist.github.com/294476.

We're interested in collecting other implementations and/or test cases -- if you have one, please send me an e-mail and we'll post it too! Thanks.

Rich

Views: 416

Tags: IPv6 validator, format, ipv4, ipv6, parser, regex, regular expression, valid, well-formed

Comment

You need to be a member of iMapper Community to add comments!

Join iMapper Community

© 2012   Created by Community Admin.

Badges  |  Report an Issue  |  Terms of Service

InterMapper.com iMapper Community