Branch Reset Groups

  • + 0 comments

    \1 reference the group

    import java.io.*;
    import java.util.*;
    import java.util.regex.Pattern ;
    import java.util.regex.Matcher ;
    public class Solution {
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in) ;
            String s = in.nextLine() ;
            String pattern = "^[0-9]{2}(-|:|---|\\.){1}[0-9]{2}\\1[0-9]{2}\\1[0-9]{2}$"  ;
            Pattern pat  = Pattern.compile(pattern) ;
            Matcher matcher = pat.matcher(s) ;
            boolean match = matcher.find() ;
            if(match)
            {
                System.out.println("true") ;
            }
            else
            {
                System.out.println("false") ;
            }  
        }
    }