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

98
Vistas
Cypress Intercept, refining url

I'm intercepting a request with Cypress and I'm trying not to hardcode something. To make it work correctly, I have to add a "1" since I'm trying to intercept something like this:

/api/v1/contacts/cfs:12345/forms/144543

The problem is that there are other requests like /forms/something that are being intercepted if I use forms/**, leading to this:

let urlResponse = '/api/v1/contacts/cfs:' + $code + '/forms/1**'

Is there any regex or something that could let me just intercept the URL that's forms/number and not forms/something or forms/number/something?

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

0

Here is some regex for matching just the .../forms/number pattern.

const inputs = [
  '/api/v1/contacts/cfs:12345/forms/144543',
  '/api/v1/contacts/cfs:12345/forms/something',
  '/api/v1/contacts/cfs:12345/forms/144543/something'
];

const regex = new RegExp('/api/v1/contacts/cfs:12345/forms/[0-9]+$');

for (let input of inputs) {
  const isMatch = regex.test(input);
  console.log(isMatch);
}

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