Regular Expressions 101

Community Patterns

username

1

Regular Expression
PCRE (PHP <7.3)

/
(?=^.{3,20}$)^[a-zA-Z][a-zA-Z0-9]*[._-]?[a-zA-Z0-9]+$
/
g

Description

REGEX to validate field username 3-20 chars

Submitted by Fernando Migliorini Tenório - 8 years ago