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

241
Views
Search in bulk or word (not letters)

I want to search inside the variable, but I don't want it to search for letters as an

example :

const myText = "Hi Here We go";
console.log(myText.includes("Here")) // true
console.log(myText.includes("ere")) // false
console.log(myText.includes("Here We")) // true
console.log(myText.includes("go")) // true
console.log(myText.includes("i")) // false
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

One option is to turn the string to search for into a regular expression, and add word boundaries to the left and right side.

const myText = "Hi Here We go";
console.log(/\bHere\b/.test(myText));
console.log(/\bere\b/.test(myText));

If you have to do it dynamically...

const myText = "Hi Here We go";
const validate = needle => (new RegExp('\\b' + needle + '\\b')).test(myText);
console.log(validate('Here'));
console.log(validate('ere'));

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!