I understand that
'*' : The preceding item will be matched zero or more times.
'?' : The preceding item is optional and will be matched, at most, once.
'+' : The preceding item will be matched one or more items
Can anyone give me an example of when there would be a difference while using grep? I was using egrep, but I tried to check if I could generate different outputs for these operators.
?
and+
are part of extended regex, so you do need egrep for that to workgrep -E
in GNU grep :)?
matches a literal?
while\?
is the{0,1}
quantifier; whereas in ERE it's the other way around i.e.?
is the quantifier while\?
matches a literal?