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

102
Views
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 answers
Answer question

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 Report
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!