javascript function to check if the email address is valid edit button Edit

Murugan Andezuthu Dharmaratnam | calendar 30 October 2020 | 1632

Subtitle with Paragraph

Here is the sample script written using regex to check if the email is valid

Email valid script

function emailvalid(str) {
    var pattern = /^\w @[a-z0-9A-Z_] ?\.[a-z0-9A-Z]{2,3}$/;
    var match = str.match(pattern);
    if (match == null) {
        return false;
    } else {
        return true;

call it by using the code below
var str = $("#email").val();