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

106
Vistas
Combining Regex Patterns from various Urls

I have the following urls and I am trying to combine them into one pattern rather than multiple. How should I write this? The conditional I'm writing needs to test if it matches users or cases or both or all three, etc..

const casesUrl =  /\/api\/v1\/cases\/[\w-]+/g 
const usersUrl =  /\/api\/v1\/users\/[\w-]+/g 
const lawfirmsUrl =  /\/api\/v1\/lawfirms\/[\w-]+/g 

Is there a better way to do this than writing multiple conditional statements like below?

if (usersUrl.test(response.config.url) ) {
                return $q.reject(response);
            }

I have tried doing something similar here with no luck:

const regexUrl =  /\/api\/v1\/(users|cases)\/[\w-]+/g
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