Hackerrank – IP Address Validation

Problem Statement
A description of the problem can be found on Hackerrank.

Solution
IP4 regex:
\b(((2[0-5][0-5])|(1[0-9][0-9])|(\b[1-9][0-9]\b)|(\b\d\b))\.){3}((2[0-5][0-5])|(1[0-9][0-9])|(\b[1-9][0-9]\b)|(\b\d\b))\b

IP6 regex:
([a-f0-9]{1,4}:){7}\b[0-9a-f]{1,4}\b

I created solution in:

All solutions are also available on my GitHub.

Java

JavaScript

Scala

Ruby