Check if a String is a Valid Email

Validates whether a given string is an email using a regular expression.

TypeScript
david

13 weeks ago

function isValidEmail(email: string): boolean {
  const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
  return emailRegex.test(email);
}
1