Link to home
Create AccountLog in
Avatar of cookiejar
cookiejarFlag for United States of America

asked on

Ensure a passed string is alphanumeric

Could you please give me a method to determine if a string is alphanumeric and how to throw and error if  not.

 For example, I am passed a string and it  is used in a select statement as the table name.  If any strange characters are in the table name, the SQL will error out.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of cookiejar

ASKER

what does this mean in JAVA
"(\\p{Alnum}|_)+"
Effectively the same as i posted
:)