regex for username

match a username

^[a-z0-9_-]{3,15}$
lorem ipsum gr3at a ab abcd abcde john doe johnny abcdefghijklmnopqrst

A username is a unique identifier given to accounts in websites and social media

Alphanumeric string that may include _ and - having a length of 3 to 16 characters.


Cheatsheet

expr usage
/[a-zA-Z0-9]/ matches all lowercase, uppercase letters and numbers
/(hello){1,3}/ matches "hello" that occur between 1 and 3 times (inclusive)
/^/ matches beginning of a line
/$/ matches end of a line
iHateRegex
by geon