How to check email id format in ServiceNow

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }

   //Type appropriate comment here, and begin script below

    var fieldName = "u_email_id"; //Email address field name
    var email = newValue + ''; //Make sure this is a string by appending the "" to it
    var regEx = new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);

    g_form.hideFieldMsg(fieldName);

    if (!regEx.test(email)) {
        g_form.showFieldMsg(fieldName, 'Please enter a valid email address', 'error');
    }
}