Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I wouldn't use a single regexp for complete username validation -- if it fails, all you can display is a generic "username is not valid, it must obey rules X, Y & Z" message. I'd check min and max length separately and display an appropriate error message for that.

Also ignore leading/trailing spaces; or you'll end up puzzled why you have two "bob@example.org" users in your database even with appropriate database constraint, and bob mails you saying he can't login on the account he just paid for.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: