Regex for alphanumeric, but at least one letter

^\d*[a-zA-Z][a-zA-Z0-9]*$

Basically this means:

  • Zero or more ASCII digits;
  • One alphabetic ASCII character;
  • Zero or more alphanumeric ASCII characters.

Try a few tests and you’ll see this’ll pass any alphanumeric ASCII string where at least one non-numeric ASCII character is required.

The key to this is the \d* at the front. Without it the regex gets much more awkward to do.

Leave a Comment