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

291
Vistas
How to properly escape question mark in regex?

I have regex below that should detect interrogative sentence. But the problem is it does not include the question mark when I test it in regexr.com

Someone knows what is missing? thanks


Here's my regex (i tried to use double backlash but still not work):

\bWhat’s up\\?\b

Tested string: "Subject: What’s up? Christie"

Here's regexr: https://regexr.com/65l08

Image: enter image description here

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

0

Two issues:

Firstly to escape a ? character, you only need a single backslash. Two backslashes will match a literal \ character. (MDN: Character Classes)

Secondly, a ? is not a word character. \b matches the boundary between a word and a non-word character: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Assertions

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