Regex: only alphanumeric but not if this is pure numeric

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.


So we know that there must be at least one "alphabetic" character in there somewhere:

[a-zA-Z]

And it can have any number of alphanumeric characters (including zero) either before it or after it, so we pad it with [a-zA-Z0-9]* on both sides:

/^[a-zA-Z0-9]*[a-zA-Z][a-zA-Z0-9]*$/

That should do the trick.