Skip to content

fix: email validation, first index contain letter , accept some symbols

Choose a tag to compare

@alguerocode alguerocode released this 02 Feb 18:47
· 27 commits to main since this release

fix: email validation, first index contain letter , accept some symbols
src/lib/volder-types/email.js

export const Email = (input) => {
  const regex = /^[\w.~!#$%&'*+-/=?^_`{|]+@[a-zA-Z\d.-]+\.[a-zA-Z]{2,6}$/;
  const code = String(input).charCodeAt(0);

  if (!(code > 64 && code < 91) && !(code > 96 && code < 123)) {
    return false;
  }
  return regex.test(String(input))
};