Email and date validation without regular expressions

November 28, 2008

I just discovered filter_var() –  very handy for validating form input, I’ve switched over from validating emails with regular expressions and I use this instead now:


… so now I don’t have to worry me getting the regexp wrong and rejecting emails when I shouldn’t. Nice. I used to validate date using regular expressions too, changed that too recently to use checkdate() (another new discovery, even though it’s been around since php4).

If only javascript had better built-in functionality for validating this stuff on the client side too I’d be laughing

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: