Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^[A-Za-z][A-Za-z0-9-_]{2,15}$
/
gm

Description

This expression checks whether the string is a valid psnID.

  • between 3 and 16 characters
  • starts with a latin letter [a-zA-Z]
  • can only contains latin letters [a-zA-Z], arabic numbers [0-9], hyphens [-] and underscores [_]
Submitted by anonymous - 4 years ago