str:要判断的字符

1.判断字符串是否包含字母,数字符号

str.matches("^(?:(?=.*[0-9].*)(?=.*[A-Za-z].*)(?=.*[\\W].*))[\\W0-9A-Za-z]{8,16}$")

2.判断字符串是否包含大写字母

str.matches(".*[A-Z]+.*")

3.判断字符串是否包含小写字母

str.matches(".*[a-z]+.*");

4.判断字符串是否包含字符

str.matches(".*[~!@#$%^&*()_+|<>,.?/:;'\\[\\]{}\"]+.*");

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案