Which operator in a regular expression matches the preceding character either zero or one time?
A. ?
B. *
C. +
D. %
E. $
Which operator in a regular expression matches the preceding character either zero or one time?
A. ?
B. *
C. +
D. %
E. $
The answer is A.
https://learning.lpi.org/
3.2 Searching and Extracting Data from Files
Lesson 2
“Zero or one of the preceding pattern.”
Izzy, friend. The right answer is “?” (A), because it says zero or one time, not many times in the case of asterisk (*).
Correct is B (*)
https://www.tldp.org/LDP/Bash-Beginners-Guide/html/sect_04_01.html
? The preceding item is optional and will be matched, at most, once.
* The preceding item will be matched zero or more times.
? The question mark indicates zero or one occurrences of the preceding element. For example, colou?r matches both “color” and “colour”.
* The asterisk indicates zero or more occurrences of the preceding element. For example, ab*c matches “ac”, “abc”, “abbc”, “abbbc”, and so on.
source: https://en.wikipedia.org/wiki/Regular_expression#:~:text=A%20regular%20expression%20(shortened%20as,strings%2C%20or%20for%20input%20validation.