Okay, I'm just returning to
Java & programming after a few years hiatus.
I'm trying to see if a
string consists of only alphanumeric characters. Is using regular expressions for this appropriate? That is, a String like "555-aws" is bad while "3lsfs" is good.
Here's the code I'm using which doesn't seem to work for more than one character. (I know, the
pattern doesn't look for digits yet.) What regular expression should I be using?
String s = "ss";
Pattern p = Pattern.compile("[a-z]");
Matcher m = p.matcher(s);
System.out.println(m.matches());
Thanks.