Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

158
Vistas
Regex for Invalid emails

I have to create some validation for emails using regex.

I wrote these parts from the validation:

  const regex = {
  whitespace: /^(?!\s+$)/g,
  emailMultipleSeparatedBySemicolon:/^(\s?[^\s,]+@[^\s,]+\.[^\s,]+\s?;)*(\s?[^\s,]+@[^\s,]+\.[^\s,]+)$/g,
};

and I'm using it this way in the code:

 sendTo: Yup.string()
        .max(255, this.props.t("createEmail.error.errorTooLong255"))
        .matches(
          regex.emailMultipleSeparatedBySemicolon,
          this.props.t("createEmail.error.emailMultipleSeparatedBySemicolon")
        )
        .matches(
          regex.whitespace,
          this.props.t("createEmail.error.errorNoWhitespace")
        )
        .required(this.props.t("createEmail.error.required")),

However when I add more than one recipient like this: hNw6B@90.com;test , I don't get the error for invalid email, although the second one test (after the semicolon) is not valid. If I add it this way: hNw6B@90.com; test (with space between the semicolon and test) - it is marked as invalid.

I will be very grateful if you can help me out!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda