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

135
Views
jQuery REGEX filtering option text by a string integer

I want to create a RegExp that takes in a variable as part of the string.

I am parsing a list of options and I want to select the option based on if it's text contains a number but the problem is that just using .includes('1') will select 1: and 10:

I want the RegExp to do this:

/^{myNumber}:/

The option list I am trying to sort has numbers that look like this:

1: this is a string

2: comment

3: option

        let locatedTask = $task.find('option').filter(function() {
          if($(this).text().includes('1')){ 
            return $(this).html();
          }
        });
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!