I would like to validate a username with these parameters: “it may only contain alphanumeric characters or dashes and cannot begin with a dash and must have a length between 2-20 characters”
this is my attempt, but it’s not quite right
/^[a-z0-9]+([a-z0-9-]+[a-z0-9])?$/i
thanks for any help
[^-]allows all sorts of non alphanumeric characters.