How to limit string size for this regular expression?
/^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/
I just need to add the quantifier {3,16}
{3,16}
Use regex
/^[a-z](?:[a-z\d]|_(?!_)){1,14}[a-z\d]$/
or
/^(?=.{3,16}$)[a-z][a-z\d]*(?:_[a-z\d]+)*$/