← Quiz: Regular Expressions in Python: all 10 questions
Quiz: Regular Expressions in Python · Question 7 of 10
What is the difference between . and .??
What is the difference between .* and .*??
- A.
.*takes as much text as possible;.*?takes as little as possible - B.
.*?matches an optional dot - C.
.*is lazy and.*?is greedy - D.There is no difference
Answer & explanation
Correct answer: .* takes as much text as possible; .*? takes as little as possible
Adding ? after a quantifier makes it lazy.
Can you get the rest right without peeking?
Take the timed Quiz: Regular Expressions in Python quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →