Tag: reg-ex

Simple Reg-Ex to Validate an Email Address

by Matt Danger on Nov.24, 2008, under PHP

Regular expressions can be a pain sometimes. Here’s a code snippet to make your life a little easier when validating email addresses:

$email = 'user@example.com';
if (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $email)) {
    print_error("Your email address is invalid!");
}
Leave a Comment :, , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Send me a message on AIM!

Friends

Read what I read...