View Single Post
Old 01-22-2010, 12:40 AM  
borked
Totally Borked
 
borked's Avatar
 
Industry Role:
Join Date: Feb 2005
Posts: 6,284
Quote:
Originally Posted by anicetan View Post
I don't think the minus sign is a metacharacter, so you don't need to escape it.

^[A-Za-z0-9\.-_]{3,32}$

Good luck
If the minus sign isn't a metacharacter, then what is it doing in eg A-Z and a-z and 0-9???

Of course it needs escaping

^[A-Za-z0-9\.\-_ ]{3,32}$

or shorter still
^[\w\.\-]{3,32}$
note with this though, \w as it's recognising word characters, will allow tabs and line breaks, not just white space.... if you don't want them, negate them:
^[\w\.\-^\t^\n]{3,32}$
__________________

For coding work - hit me up on andy // borkedcoder // com
(consider figuring out the email as test #1)



All models are wrong, but some are useful. George E.P. Box. p202
borked is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote