Monday, February 06, 2006

regex validate username

A-Z
0-9
hyphens
no more then 2 hyphens
first character can not be a hyphen
2 hyphens can not be next to each other
hyphen cannot be the last char in the string

^(?!-)(?![0-9])(?!.*-{2})(?!(.*-){3,})([a-zA-Z0-9-_]{1,25})[a-zA-Z0-9]$

0 Comments:

Post a Comment

<< Home