Hi,
Does anyone have some JavaScript that can verify a valid email address in the code module?
I have the following - but I cant find the right way of performing the test, I’m not a programmer but I cant see why this isn't working? Any help much appreciated. At the moment it seems to pass everything through.
if(inputData.eMail == null){
return{ rv: ""}
}
else {
const myEmail = inputData.eMail.replace(/\s+/g, '') // remove all whitespace from string
const RegExpConst = /(?:[a-z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/
if(myEmail.matchAll(RegExpConst)){
return {rv: myEmail}
}
else return {rv: ""}
}