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.

Leave a Comment