I need a help with regex which checks the string contains only letter and numbers but not only numbers
Valid
* letters
* 1wret
* 0123chars
* chars0123
*
^([a-zA-Z0-9]*)([a-zA-Z]+)([a-zA-Z0-9]*)$
this should work ^([a-zA-Z0-9]*)([a-zA-Z]+)([a-zA-Z0-9]*)$
EDIT sry got the *
and the +
messed up
Personally (I hate regex and find them generally to be hard to maintain), I'd do it in two steps.
([0-9]*[a-zA-Z]+)+