Regular Expressions 101

Community Patterns

user name between 2 and 30 character

0

Regular Expression
ECMAScript (JavaScript)

/
^[a-zA-Z]([a-zA-Z0-9]{0,28}|[a-zA-Z0-9]{0,26}[_.]?[a-zA-Z0-9]{0,26}|[a-zA-Z0-9]{0,27}[_.]?|[_.]?[a-zA-Z0-9]{0,27})[a-zA-Z0-9]$
/
mg

Description

regex for user name with criteria:

  • Minimum 2 character
  • Maximum 30 character
  • Character must be alphanumeric, except first character is alphabetical
  • Character "_" and "." is allowed once between first and last character
Submitted by aicone.id - 2 years ago (Last modified 8 months ago)