I am trying to check if string (user input) is strictly alphanumeric or not.
I tried following check in java
if (str.matches("^[\\p{Alnum}]*$")){
System.out.println("String is Alphanumeric");
}
This paases for all following input
rfvtgbyhnujm
235675434567
3edc4rfv5tgb
cde3vfr4bgt5
I just want it to pass for 3edc4rfv5tgb
& cde3vfr4bgt5
.
almost all forums suggested this solution, but it doesn't work for me. Don't know what I am missing here.
I just want it to pass for pure alpha-numeric strings, no special characters.