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

61
Views
Array of String Search in express.js

I have array of string like this

let search = ["user","country"];

I want to get data from mysql database using LIKE operator.

For example like this

searchStmnt = `u.u_fullname LIKE "%` + search + `%"`

But the above code is not working. Can anyone suggest me how to do that?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

const search = ["user", "country"];
const searchStmnt = search.map(item => `u.u_fullname LIKE '%${item}%'`).join(" OR ");
console.log(searchStmnt);

...or with REGEXP:

const search = ["user", "country"];
const searchStmnt = `u.u_fullname REGEXP '(${search.join("|")})'`;
console.log(searchStmnt);

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!