How to create a regex for accepting only alphanumeric characters? [duplicate]

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

Leave a Comment