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: Java JavaScript Scala Ruby All solutions are also available on my GitHub. Java

JavaScript

Scala

Ruby

Hackerrank – HackerRank Tweets

Problem Statement A description of the problem can be found on Hackerrank. Solution Check if every line in lowercase matches this regex pattern: .*hackerrank.* I created solution in: Java JavaScript Scala Ruby All solutions are also available on my GitHub. Java

JavaScript

Scala

Ruby

Hackerrank – Find Hackerrank

Problem Statement A description of the problem can be found on Hackerrank. Solution Print “0” if the input matches ^hackerrank$ or ^hackerrank.*hackerrank$ Print “1” if the input matches ^hackerrank.* Print “2” if the input matches .*hackerrank$ else print “-1” I created solution in: Java JavaScript Scala Ruby All solutions are also available on my GitHub. […]

Hackerrank – Find a Substring

Problem Statement A description of the problem can be found on Hackerrank. Solution For all lines cout all ocurrences of this regex pattern: \w+{substring}\w+ I created solution in: Java JavaScript Scala Ruby All solutions are also available on my GitHub. Java

JavaScript

Scala

Ruby

Hackerrank – Detecting Valid Latitude and Longitude Pairs

Problem Statement A description of the problem can be found on Hackerrank. Solution My regex for validating longitude and latitude pairs: \([+-]?((90(\.0+)?)|([1-8][0-9](\.[0-9]+)?)|([0-9](\.[0-9]+)?)),\s*[+-]?(((([1-9][0-9])|([0-9]))(\.[0-9]+)?)|(1((80(\.0+)?)|([0-7][0-9](\.[0-9]+)?))))\) All solutions are also available on my GitHub.

Hackerrank – Detect HTML Attributes

Problem Statement A description of the problem can be found on Hackerrank. Solution Parse all tags with attributes. Then parse only tags and attributes. Group attributes by tag name. Sort grouped tags and accordingly attributes. I created solution in: Java Scala All solutions are also available on my GitHub. Java

Scala

Hackerrank – Alien Username

Problem Statement A description of the problem can be found on Hackerrank. Solution Regular Expression that validates input username: ^[_\.]\d+[a-zA-Z]*_?$ I created solution in: Java JavaScript Scala Ruby All solutions are also available on my GitHub. Java

JavaScript

Scala

Ruby