How can I check if a string contains only numbers and alphabets ie. is alphanumeric?
Pattern pattern = Pattern.compile("^[a-zA-Z0-9]*$"); Matcher matcher = pattern.matcher("Teststring123"); if(matcher.matches()) { // yay! alphanumeric! }