Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

287
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!