// 按指定模式在字符串查找
String line = "8784ssR#";
String pattern = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_.]).{8,}";
// 创建 Pattern 对象
Pattern r = Pattern.compile(pattern);
// 现在创建 matcher 对象
Matcher m = r.matcher(line);
boolean matches = m.matches();
System.out.println(matches);

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-13
猜你喜欢
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
相关资源
相似解决方案