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

152
Vistas
Google Apps Script not recognizing strings with parentheses and brackets as part of the string

I have a conditional that is supposed to compare two strings:

if (parametros.toString().toLowerCase().match(valor_celda_activa.toString().toLowerCase()) != null){
...actions here...
}

This works ok UNTIL there is some parentheses or bracket inside the string.

Working example strings:
parametros = "1.01 - Sourcing Gathering information"
valor_celda_activa = "1.01 - Sourcing Gathering information"

NOT working example strings:
parametros = "1.01 - [Sourcing] Gathering information"
valor_celda_activa = "1.01 - [Sourcing] Gathering information"

Note the brackets inside the strings. As long as the brackets are present, the code won't work. This also happens with parentheses.

Haven't actually found this kind of specific situation from someone else on the internet.

This is really my first question on StackOverFlow so feel free to feedback or request more information that I might have missed.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

String.match expects a regular expression. Square brackets [] have special meaning in regex. For plain text matching, just use ===:

if (parametros.toString().toLowerCase() === valor_celda_activa.toString().toLowerCase()){
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