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

145
Vistas
How do I get a readlinesync input value to be accepted only if lawProcessNumber equals law, and if not, keep asking until that value equals law?

I'm writing a code that receives an input from a readline-sync question. If this value is different from the law structure, it must repeat the question until the value equals law.

For this code, I'm using javascript, puppeteer and readline-sync (libraries).

const lawProcessNumber = readlineSync.question(console.log(
    "Input a law process number like this example\n(0000000-00.0000.8.16.0000): "))
  const validNumber = /^(([0-9]{7}-[0-9]{2}.[0-9]{4}.8.16.[0-9]{4}))$/
  const law = validNumber.test(lawProcessNumber)
  if (!law) {
    return false
  }

For now, my code just receives the value and continues if everything is ok. If the value is not right, it stops.

I will use this input value in a future puppeteer code.

How do I get a readlinesync input value to be accepted only if lawProcessNumber equals law, and if not, keep asking until that value equals law?

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