2017-02-12 00:31:12 -08:00
|
|
|
// Author: Rodney Shaghoulian
|
|
|
|
|
// Github: github.com/rshaghoulian
|
|
|
|
|
// HackerRank: hackerrank.com/rshaghoulian
|
|
|
|
|
|
2017-02-09 02:34:19 -08:00
|
|
|
/*
|
|
|
|
|
[01]?\\d{1,2} matches numbers 0-199.
|
|
|
|
|
2[0-4]\\d matches numbers 200-249
|
|
|
|
|
25[0-5] matches numbers 250-255
|
|
|
|
|
*/
|
|
|
|
|
class MyRegex {
|
|
|
|
|
String num = "([01]?\\d{1,2}|2[0-4]\\d|25[0-5])";
|
|
|
|
|
String pattern = num + "." + num + "." + num + "." + num;
|
2017-02-09 02:12:38 -08:00
|
|
|
}
|