Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

104
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda