Pattern pattern = Pattern.compile("^([a-z]+|[A-Z]+|[0-9]+)$"); Matcher m = pattern.matcher("fwefw"); System.out.println(m.matches()); @H_403_4@