Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

162
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda