-3

How do I ignore the question mark in a regular expression?

For example:

xxx.com/supplier.php?id=500

I want to write something like:

xxx.com/supplier.php?id=.*

Therefore I need to ignore the question mark.

TylerH
  • 20,799
  • 66
  • 75
  • 101
pingping
  • 37
  • 1
  • 8
  • Escape the question mark and dots so that they are treated as literals. See [What special characters must be escaped in regular expressions?](http://stackoverflow.com/questions/399078/what-special-characters-must-be-escaped-in-regular-expressions). – Wiktor Stribiżew Nov 13 '15 at 15:44
  • use the escape character. for majority of syntaxes is \ so `\?` would match a literal `?` – Marco Fatica Nov 13 '15 at 15:47

1 Answers1

0

You would normally escape with the \ character, and also this applies to the / character DEMO

xxx.com\/supplier.php\?id=.*
ergonaut
  • 6,929
  • 1
  • 17
  • 47