【发布时间】:2021-01-26 02:25:45
【问题描述】:
我怎样才能使用这样的方法
private boolean respectPattern(String password) {
Pattern passwordPattern = Pattern.compile(
"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[.@$!%*?&])[A-Za-z\\d@$!%*?&.]{8,}$",
Pattern.CASE_INSENSITIVE);
Matcher matcher = passwordPattern.matcher(password);
return matcher.find();
}
如果我将password 类型替换为StringBuffer 或char[]?
【问题讨论】:
标签: java string matcher stringbuffer