010-160 Exam QuestionsBrowse all questions from this exam

010-160 Exam - Question 67


Which operator in a regular expression matches the preceding character either zero or one time?

Show Answer
Correct Answer: A

The operator in a regular expression that matches the preceding character either zero or one time is the question mark (?). This means that the character before ? may appear zero or one time in the string being searched. For example, the regular expression colou?r matches both 'color' and 'colour'.

Discussion

14 comments
Sign in to comment
linglingaOption: A
Jan 27, 2021

? The preceding item is optional and will be matched, at most, once. * The preceding item will be matched zero or more times. The answer is A. 100%. It is asking zero or ONE time.

cyberchickOption: A
Jan 10, 2021

I'm assuming the question was not clear or either a tricky question, but this is what I found and would stick with "A" being the correct answer (\? Matches zero or one occurrence of the previous character ). * would be zero or more. Source: https://www.guru99.com/linux-regular-expressions.html

Tocketman
Jan 12, 2021

But it clearly states in your source that * matches up zero or more times the preceding character

kimalto452
Sep 11, 2021

Which operator in a regular expression matches the preceding character either zero or one time?

kimalto452
Sep 11, 2021

matches the preceding character either zero or one time?

kimalto452
Sep 11, 2021

zero or one time?

kimalto452
Sep 11, 2021

ONE time?

Traian
Aug 23, 2021

B is correct

DAC3
Mar 1, 2022

B is the correct answer. Table 4-1. Regular expression operators Operator Effect . Matches any single character. ? The preceding item is optional and will be matched, at most, once. * The preceding item will be matched zero or more times. + The preceding item will be matched one or more times. {N} The preceding item is matched exactly N times. {N,} The preceding item is matched N or more times. {N,M} The preceding item is matched at least N times, but not more than M times. - represents the range if it's not first or last in a list or the ending point of a range in a list. ^ Matches the empty string at the beginning of a line; also represents the characters not in the range of a list. $ Matches the empty string at the end of a line. \b Matches the empty string at the edge of a word. \B Matches the empty string provided it's not at the edge of a word. \< Match the empty string at the beginning of word. \> Match the empty string at the end of word.

h0stOption: B
Jan 9, 2021

B is the correct answer , ? in cammande line mean that is one character , but * mean a one or r zero or more in the same time

johard
Jan 9, 2021

this is correct

johard
Jan 9, 2021

this is correct. * is the correct answer

kimalto452
Sep 11, 2021

Which operator in a regular expression matches the preceding character either zero or one time?

AndrewGrassoOption: A
Oct 23, 2023

The operator that matches the preceding character either zero or one time is the question mark (?) For example, the regular expression colou?r matches both “color” and “colour”.

TocketmanOption: B
Jan 12, 2021

I would go with B. Literally google it and you will find it.

beazzlebub
Jul 26, 2021

B is wrong, matches 0 or more times. A is correct, "?" matches zero or one time as is asked in the question.

sminaOption: A
May 13, 2021

The asterisk is used to find something that is repeated 0 or more times. For example, using the expression "[a-zA-Z] \ d *" it will be possible to find both "H" and "H1", "H01", "H100" and "H1000", that is, a letter followed by a undefined number of digits.

Temas84
Jan 29, 2022

Correct answer is B

RouterOption: A
Nov 16, 2022

A is the correct

Dever24Option: B
Feb 18, 2023

https://tldp.org/LDP/Bash-Beginners-Guide/html/sect_04_01.html

FakenixOption: A
Jun 11, 2023

The question asks "IN A REGULAR EXPRESSION" If you read any documentation, you'll see that the correct answer is A (I mean, the "?")

SilverFox22Option: A
Sep 21, 2023

? is used when it is zero or ONE, and * is used for zero or MORE. Thus ? is the answer, since it more precisely matches the question asked. See https://www.geeksforgeeks.org/how-to-use-regular-expressions-regex-on-linux/# and go to 7.