diff --git a/i18n-tool.js b/i18n-tool.js index f9625b6..d7cf9f6 100644 --- a/i18n-tool.js +++ b/i18n-tool.js @@ -19,8 +19,23 @@ module.exports = { } }, + /* + - https://regex101.com/r/3uvtNl/1 + /^((?:[A-Za-z0-9!#$%&'*+\-\/=?^_`{|}~]|(?<=^|\.)"|"(?=$|\.|@)|(?<=".*)[ .](?=.*")|(?()\[\]\\.,;:\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,}))$/ + */ validate_email ({ email, format } = {}) { - if (format) return new RegExp(format).test(email) - return /^.+@[^\.]+\..+$/.test(email) + let regex = + /^((?:[A-Za-z0-9!#$%&'*+\-\/=?^_`{|}~]|(?<=^|\.)"|"(?=$|\.|@)|(?<=".*)[ .](?=.*")|(?