🎙 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 8 of 10

re.search(r"\d+", "no digits here") returns what?

re.search(r"\d+", "no digits here") returns what?

  1. A.An empty string
  2. B.0
  3. C.It raises an error
  4. D.None
Answer & explanation

Correct answer: None

When nothing matches, search returns None, so check it before calling .group().

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 →