Fri, 17 May 2024


How to write a regular expression which validates an email address?

By: Peter, NetArt Media
Sun, 26 July 2020

To do this, you may use the following php function:

<?php

function IsValid($strEmail) {
if(eregi("^[a-z0-9._-]+@[a-z0-9._-]+.[a-z]{2,4}$", strEmail))
{
return true;
}
else
{
return false;
}

}

?>


Category: PHP Examples
Share this post:



See All Scripts






Subscribe for our newsletter

Receive the latest blog posts direct in your mailbox