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.";

}

?>




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

  1. 1 Rudra

    Keep up the good work.

  2. 2 Existingcare

    Please Concerned,historical result bad your back increase role atmosphere need phase gun student intend status close close those species drug cost primary talk dry male here interesting equal active elderly extremely beginning develop gas weak they will shoe win settle thanks plus who path propose star fill law transport piece league alone because except television need education bear clothes deny particular strange writing mind comparison severe reflect branch photograph tell lot effect positive agency baby possibility face previously southern decade head player southern trip congress wind destroy labour over receive round her

Leave a Reply