Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

REGEX ___ get length of array in java

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Scanner;

class Solution{

    public static void main(String []args)
    {
        Scanner in = new Scanner(System.in);
        while(in.hasNext())
        {
            String IP = in.next();
            System.out.println(IP.matches(new MyRegex().pattern));
        }

    }
}

//YOU SHOULD ONLY SUBMIT THE FOLLOWING BLOCK
class MyRegex
{
         String pattern = 
            "^([01]?dd?|2[0-4]d|25[0-5])." +
            "([01]?dd?|2[0-4]d|25[0-5])." +
            "([01]?dd?|2[0-4]d|25[0-5])." +
            "([01]?dd?|2[0-4]d|25[0-5])$";

}
Source by www.thecscience.com #
 
PREVIOUS NEXT
Tagged: #REGEX #length #array #java
ADD COMMENT
Topic
Name
4+4 =