LearnFrenzy
Sign in Take a free test

Regular Expressions · Regular Expressions MCQ · Question 2

When to use fullmatch() Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 2 Back to Exercise

Which function is best for checking that a whole input is a 6-digit PIN code?

  • A re.fullmatch(r"\d{6}", pin) Correct
  • B re.search(r"\d{6}", pin)
  • C re.findall(r"\d", pin)
  • D re.split(r"\d{6}", pin)
Correct Answer: Option A

search would also accept "1234567" or "PIN 123456".

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links