Regular Expressions 101

Community Patterns

Community Library Entry

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 - 3 years ago (Last modified a year ago)