To make a character or pattern optional, use parentheses with a trailing question mark: (string)?.
Pattern | Description |
|---|---|
code red (virus)? | The search for the word "virus" is optional. This pattern matches if either "code red" or "code red virus" is detected. |