Page 1 of 1

PHP validation class

Posted: Mon Jun 18, 2007 5:54 am
by staar2
I need some validation class wich isn't big. Search from google but didn't find nofthing useful.
TY

Posted: Mon Jun 18, 2007 5:56 am
by volka
validating what?

Posted: Mon Jun 18, 2007 2:54 pm
by staar2
OOps! Validatiting data from form post.

Posted: Mon Jun 18, 2007 3:50 pm
by superdezign
You could write a few small regexps.

Username (length 6-18):

Code: Select all

^[A-Za-z0-9_]{6,18}$
Email:

Code: Select all

^[^@\s]+@[^\.]+\.(?:[\w]{2,4}(?!\.)|[\w]{2}\.[\w]{2})$
I'm not too sure about my email regex and the whole RCC compliance thing though. :P

Posted: Mon Jun 18, 2007 4:09 pm
by feyd
superdezign wrote:Email:

Code: Select all

^[^@\s]+@[^\.]+\.(?:[\w]{2,4}(?!\.)|[\w]{2}\.[\w]{2})$
I'm not too sure about my email regex and the whole RCC compliance thing though. :P
It's definitely not. :)

Posted: Mon Jun 18, 2007 4:33 pm
by superdezign
Hehe, figures. I should really read up on that one day.

Maybe today.

Posted: Mon Jun 18, 2007 5:00 pm
by feyd
superdezign wrote:Hehe, figures. I should really read up on that one day.

Maybe today.
No need... viewtopic.php?t=66712&highlight=validateemailformat

Posted: Mon Jun 18, 2007 5:07 pm
by superdezign
^_^

There's a lot of invalid characters.

Posted: Mon Jun 18, 2007 9:08 pm
by Ambush Commander
I've come to the conclusion, however, that RFC-validating emails is usually useless in most real-world contexts. An approximation will usually do well.

Posted: Mon Jun 18, 2007 10:03 pm
by superdezign
.. I already implemented it though. 8O

Should I rewrite my regex? (which I just realized is already here ^_^)