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

131
Vistas
Strong Password validation doesn't detect forward slash

I have the following regex for testing a strong password:

/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d!$\/%@]{6,20}$/

Rules:

  • alphanumeric with special characters $/%@
  • min 1 number
  • min 1 small
  • min 1 capital
  • 6-20 length
  • min 1 special character $/%@

My question is mostly about the last rule of minimum 1 special character when that character is a forward slash.

The following code, for special character @, returns TRUE as expected:

/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d!$/%@]{6,20}$/.test("Test@2")

But the following code, for forward slash, does NOT:

/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d!$/%@]{6,20}$/.test("Test/2")

I also tried to escape both the regex and the test string forward slash with / but that does not seem to return TRUE

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

My mistake was in the first validation of the special characters. The working solution is:

/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!$\/%@])[A-Za-z\d!$\/%@]{6,20}$/
about 4 years ago · Juan Pablo Isaza Denunciar
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