Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

160
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda