1. Home
  2. Data Science
  3. Python
  4. What does re.match() check in Python?

Added 25 Nov 2026

What does re.match() check in Python?

  1. Whether the pattern appears anywhere in the string
  2. All matches in the string
  3. Whether the pattern matches at the beginning of the string Correct answer
  4. Only the end of the string

Correct answer

C. Whether the pattern matches at the beginning of the string

8 views

MCQSEXAM

Explanation

re.match anchors at the start; re.search scans the whole string.

Reference

Asked in: Python Interview Standard Library

https://docs.python.org/3/library/index.html

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs