For instance:
'1' => NG '243' => NG '1av' => OK 'pRo' => OK '123k%' => NG
I tried with
/^(?=^[^0-9]*$)(?=[a-zA-Z0-9]+)$/
but it is not working very well.
Use
/^(?![0-9]*$)[a-zA-Z0-9]+$/
This expression has a negative lookahead to verify that the string is not only numbers. See it in action with RegExr.
2.1m questions
2.1m answers
60 comments
57.0k users