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

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

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 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