email trim

mail@pastecode.io avatar
unknown
plain_text
2 years ago
292 B
0
Indexable
Never
const validate = (email) => {
    if (email.trim(/^([a-zA-Z0-9_\-.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9-]+\.)+))([a-zA-Z]{1,5}|[0-9]{1,3})(\]?)$/).match() == null) {
      return false;
    } else if (email.trim() === '') {
      return false;
    }

    return true;
  }