import java.util.regex.*;
class GFG {
public static void
isAllPresent(String str)
{
String regex = "^(?=.*[a-z])(?=."
+ "*[A-Z])(?=.*\\d)"
+ "(?=.*[-+_!@#$%^&*., ?]).+$";
Pattern p = Pattern.compile(regex);
if (str == null) {
System.out.println("No");
return;
}
Matcher m = p.matcher(str)
if (m.matches())
System.out.println("Yes");
else
System.out.println("No");
}
public static void main(String args[])
{
String str = "Password#123@";
isAllPresent(str);
}
}
Comments
Post a Comment