Regular Expressions 101

Community Patterns

username in url

-2

Regular Expression
PCRE (PHP <7.3)

/
^[A-Za-z]+[A-Za-z0-9]*(?:[-][A-Za-z0-9]+)*$
/

Description

should start with letter follow by letters and numbers and (-) - zero or more can't start or finish with (-) can't have two or more consecutive (-) char

Submitted by Ali Azmoude - 9 years ago