Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!