I usually use this javascript function to validate in frontend:
function validateEmail(email)
{
var re = /^(([^<>()[]\.,;: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,}))$/
return email.match(re)
}
it returns true or false.
But anyway, you shouldn't usually only validate sensitive data in the frontend, but also on the server side.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…