-9

I want to validate the input data to allow only alphanumeric value. It should not be only numbers or only alphabets. How to do that using regex expression in Java?

dda
  • 5,760
  • 2
  • 24
  • 34
  • You can find another resolve ways here [How to create a regex for accepting only alphanumeric characters?](http://stackoverflow.com/questions/5988228/how-to-create-a-regex-for-accepting-only-alphanumeric-characters) – Duy Huynh Dec 21 '15 at 10:23

1 Answers1

2

You can very easily find the character class for alphanumeric characters in the Pattern javadoc:

\p{Alnum} An alphanumeric character: [\p{Alpha}\p{Digit}]

Andy Turner
  • 131,952
  • 11
  • 151
  • 228