← 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?
- A.An empty string
- B.0
- C.It raises an error
- 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 →