Regex for Username (3-16, alnum/underscore)

Matches a username of 3-16 letters, digits or underscores.

^[a-zA-Z0-9_]{3,16}$

Proof it works

5/5 sample tests passed · compiles: true

SampleShould matchResult
john_doe yes pass
user123 yes pass
ab no pass
this_name_is_way_too_long no pass
bad name no pass

Try your own input

Related patterns