String st = "q!w_e*"
Pattern pattern = Pattern.compile("(\\W)|(_)");
Matcher matcher = pattern.matcher(st);
long matches = matcher.results().count();
System.out.println(matches);
public static boolean check(String name, String email, String password) throws SQLException {
ResultSet resultSet = statement.executeQuery(String.format("""
SELECT count(*) as cnt FROM userlogins
WHERE name = '%s' AND email = '%s' AND password = '%s'
""", name, email, password));
resultSet.next();
return resultSet.getBoolean(1);