Skip to content

Instantly share code, notes, and snippets.

@engmagdy87
Created August 6, 2020 21:33
Show Gist options
  • Select an option

  • Save engmagdy87/277892fd146f1e183648bbfa5c5c3326 to your computer and use it in GitHub Desktop.

Select an option

Save engmagdy87/277892fd146f1e183648bbfa5c5c3326 to your computer and use it in GitHub Desktop.
const validateEmailAndPhoneNumber = function (value) {
const emailRegEx = /^([a-zA-Z0-9])(([a-zA-Z0-9])*([\._\+-])*([a-zA-Z0-9]))*@(([a-zA-Z0-9\-])+(\.))+([a-zA-Z]{2,4})+$/;
const mobileRegEx = /^\d{11}$/;
return emailRegEx.test(value) || mobileRegEx.test(value);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment