Which operator in a regular expression matches the preceding character either zero or one time?
A.
?
B.
*
C.
+
D.
%
E.
$
The Answer Is:
A
This question includes an explanation.
Explanation:
The operator that matches the preceding character either zero or one time in a regular expression is the question mark (?). This operator is also known as the optional quantifier, because it makes the preceding character or group of characters optional. For example, the regular expression colou?r matches both color and colour, because the u is optional. The question mark can also be used to modify other quantifiers, such as * (zero or more), + (one or more), or {m,n} (between m and n times), to make them non-greedy, meaning they will match the shortest possible string instead of the longest. For example, the regular expression .*? matches any character zero or more times, but as few as possible. The question mark is one of the basic regular expression operators covered in the Linux Essentials certification program from the Linux Professional Institute (LPI). References:
Linux Essentials - Linux Professional Institute (LPI)
Regular Expressions:Difference between ‘optional occurrence’ and 'zero …
010-160 PDF/Engine
Printable Format
Value of Money
100% Pass Assurance
Verified Answers
Researched by Industry Experts
Based on Real Exams Scenarios
100% Real Questions
Get 60% Discount on All Products,
Use Coupon: "8w52ceb345"