I try to set a rule with validatejs to detect when a string contains an email, i display an error message.
I can't find examples on the documentation, i tried :
comment: value => {
if (
/^(([^<>()[\]\\.,;:\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,}))$/.test(
value,
)
)
return {
presence: {message: 'email not authorized'},
};
return {
length: {
maximum: 255,
...
},
};
},
It does not work