Possible Duplicate:
Regular Expression for alphanumeric and underscores
How to create a regex for accepting only alphanumeric characters?
Thanks.
You can use this regex /^[ A-Za-z0-9_@./#&+-]*$/.
Try below Alphanumeric regex
"^[a-zA-Z0-9]*$"
^ - Start of string
[a-zA-Z0-9]* - multiple characters to include
$ - End of string
See more: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
[a-zA-Z0-9] will only match ASCII characters, it won't match
String target = new String("A" + "\u00ea" + "\u00f1" + "\u00fc" + "C");
If you also want to match unicode characters:
String pat = "^[\\p{L}0-9]*$";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With