Does this regex help?
^[a-zA-Z0-9]\w*$
It means:
^ = this pattern should start at the beginning of the line[a-zA-Z0-9] = this char can be any letter ( az and az ) or a digit ( 0-9 , also see \d )\w = word character. This includes letters, numbers, and spaces (not new lines by default)* = Repeat item 0 or more times$ = this pattern should end at the end of the line
To fulfill the condition that I missed, try
^[a-zA-Z0-9]*\w*[a-zA-Z]+\w*$
The added extra material allows it to have a digit for the first character, but it should always contain a letter because of [a-zA-Z]+ , since + means 1 or more.
source share