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

152
Views
Extract values from Boolean Query

I want to extract values/variables from boolean query For e.g

The boolean query is:

("Asset Data Management") AND "Data Scientist" AND ("Data Science & Analysis" OR "Financial Modelling" OR "Credit Structuring") AND ("Goldman Sachs" OR "Deutsche Bank" OR "BNY Mellon" OR "JP Morgan" OR BlackRock OR Amazon)

The expected output must be:

["Asset Data Management","Data Scientist","Data Science & Analysis","Financial Modelling","Credit Structuring","Goldman Sachs","BNY Mellon","JP Morgan","BlackRock","Amazon"]

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

0

You can simply achieve this by using regex to perform string split() and replaceAll() operation.

/AND|OR/g - This regex is used to split the original string with AND and OR and will return the array.

/"|\(|\)/ig - This regex is used to replace all the (, ) & " with the empty string.

Working Demo :

const str = '("Asset Data Management") AND "Data Scientist" AND ("Data Science & Analysis" OR "Financial Modelling" OR "Credit Structuring") AND ("Goldman Sachs" OR "Deutsche Bank" OR "BNY Mellon" OR "JP Morgan" OR BlackRock OR Amazon)';

const strArr = str.split(/AND|OR/g);

const finalArr = strArr.map(elem => {
    return elem.trim().replaceAll(/"|\(|\)/g, '')
});

console.log(finalArr);

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!