If you want a PHP script to validate an email address here is a quick and simple PHP regular expression to do it. This script is also case-insensitive, so it will treat all characters as lower case. This script is a simple and  easy way to check the syntax and format of an email address.

The code


<?php

$email "someone@example.com";

if(eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$"$email)) {

  echo "Valid email address.";

}

else {

  echo "Invalid email address.";

}

?>




4 Responses to “Validate an email address using regular expressions”  

  1. 1 Rudra

    Keep up the good work.

  2. 2 SATEESH VP

    good example

  3. 3 Celeb Tweets

    Unbelievable, that is definitely what I was scanning for! This article just saved me alot of digging around

    I’ll make sure to put this in good use! Bookmarked for the nice content

  4. 4 instant affiliate

    I and also my buddies have been studying the good tricks located on your site then quickly I had a terrible suspicion I never thanked the blog owner for those tips. All the boys came as a result joyful to learn all of them and have now without a doubt been having fun with these things. Thanks for indeed being quite thoughtful and then for figuring out such quality guides most people are really wanting to discover. My honest apologies for not saying thanks to earlier.

Leave a Reply