Validation in Java
Validations: 1. If word contains consecutive characters String userWord = "Pankaj"; Pattern pattern = Pattern.compile("(\\w)\\1{2,}"); Matcher matcher = pattern.matcher(userWord); if (matcher.find()) { System.out.println("Found value is: " + matcher.group(0)); return true; } else { System.out.println("NO MATCH"); return false; } 2. If word contains more instance of characters String userWord = "Pankaj"; Pattern pattern = Pattern.compile("(\\w)(\\w*\\1){4}"); Matcher matcher = pattern.matcher(userWord); if (matcher.find()) { System.out.println("Found value is: " + matcher.group(0)); return true; } else { System.out.println("NO MATCH"); return false; } 3. If word contains any name String firstName = "Pankaj"; String emailAddress = "pankaj.lilhare@gmail.com"; // Here I want to check first na...