Validate email using regular expression in PHP

Regular expressions, also referred to as regex or regexp, provide a concise and flexible means for identifying strings of text, such as particular characters, words, or patterns of characters.

Using below regex example, you can validate an email address –

eregi — Case insensitive regular expression match

$email = "";

(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {

echo "Valid email address.";

}else {

echo "Invalid email address.";


Related Posts:

2 Responses

dsad May 30, 2008 at 7:05 am

y u don’t allow capital chars?

master higgins May 30, 2008 at 7:05 am

Dude, eregi matches capital and non capital letters. Go to if you don’t believe me. 😉

Comments are closed.