?
The question mark ( ? ) is a metacharacter that is used in regular expressions. It matches zero or one of the characters that it follows. It can follow a regular expression that evaluates to a character.
Example
/mar?y/
will match may or mary but does not match marry
/^[-+]?[0-9]$/
will match an optional signed number.
For information on how they participated in this regular expression, see ^ [ ] - and $.
Last modified date: 12/03/2024