how to check if a string contains only alphabets and numbers in java
string.matches("[a-zA-Z]*"); // return true if it has only letters
string.matches("[0-9]*"); // return true if it has only numbers
string.matches("[a-zA-Z0-9]*"); // return true if it has only letters and numbers