In this example, we will see how to validate an eamil address in laravel and php. We will show email validation in laravel. We will learn how to validate an email with regex in laravel. if you want to check .(dot) from the email address exist or not.

This article will give you how to validate .(dot) from email address in laravel and php. Given below are three solution for .(dot) validation of email address in php laravel. one solution in laravel and two solution in php. 



Solution : In Laravel

/**
 * Get the validation rules that apply to the request.
 *
 * @return array
 */
public function store(Request $request)
{
    $request->validate([
        'email' => 'regex:/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix'
    ]);
}




Solution 1 : In PHP

<?php
    function validEmail($str) {
        return (!preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
    }
    if(!validEmail("abc@abccom")){
        echo "Invalid email address.";
    }
    else{
        echo "Valid email address.";
    }
?>



OUTPUT:

Invalid email address.




Solution 2 : In PHP

<?php
    function checkemail($str) {
        return (!preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
    }
    if(!checkemail("abc@abc.com")){
        echo "Invalid email address.";
    }
    else{
        echo "Valid email address.";
    }
?>


OUTPUT:

Valid email address.




I hope this example helps you.