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

199
Visualizações
How to filter by not exact text JS

Here is a part of ag-grid JS code that filter cells with exactly text:

function doesExternalFilterPass(node) {
  switch (status) {
    case 'released':
      return node.data.Status == 'Released';
    case 'early-access':
      return node.data.Status == 'Early access';
    case 'in-development':
      return node.data.Status == 'In development';
    case 'rtt-strategy':
      return node.data.Genre == /.'RTT'./;
    default:
      return true;
  }
}

For example, one of the strings filter all cells containing Released in Status column, other containing RTT in Genre column. But I need that strings like RTT, RTS, Action also to be filtered. As I understand, I should use regular expressions, I try this

return node.data.Genre == /.'RTT'./;

but it doesn't work.

Any ideas to get many-words filtering?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

  1. You don't need regex for this. Regex should be avoided, if possible. If I understand it correctly, you want to check if a string contains a substring. For that you can use String.prototype.includes() method: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes Example code:
case 'rtt-strategy':
  return node.data.Genre.includes('RTT');
  1. If you still want to use regex, then you can use the RegExp.prototype.test() method: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test. First of all, you really should look up how to use regex in js, because your example code is way off. Secondly, example code:
/RTT/.test(node.data.Genre)

Or if you want case insensitive, then:

/RTT/i.test(node.data.Genre)
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