Alex Rivera | Logout

How to create a regex for accepting only alphanumeric characters?

Asked 2011-05-13T06:47:11.677
51

Possible Duplicate:
Regular Expression for alphanumeric and underscores

How to create a regex for accepting only alphanumeric characters?

Thanks.

Edit
Report

2 Answers

113

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

answered 2011-05-13T06:49:48.487
4
answered 2011-05-13T06:55:19.083

Your Answer