🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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 .*??

  1. A..* takes as much text as possible; .*? takes as little as possible
  2. B..*? matches an optional dot
  3. C..* is lazy and .*? is greedy
  4. 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 →