This Python Regex Quiz covers regular expressions using the re module. Practice matching, searching, splitting, and substituting text with regex patterns to handle real-world data extraction and validation tasks.
Time limit: 0
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Which Python module is used for regular expressions?
Correct
Incorrect
Question 2 of 15
2. Question
What does the re.search() function do?
Correct
Incorrect
Question 3 of 15
3. Question
What is the output of re.match(r”\d+”, “123abc”)?
Correct
Incorrect
Question 4 of 15
4. Question
Which regex pattern matches any single character except a newline?
Correct
Incorrect
Question 5 of 15
5. Question
What does the + quantifier mean in regex?
Correct
Incorrect
Question 6 of 15
6. Question
Which of the following patterns matches exactly three digits?
Correct
Incorrect
Question 7 of 15
7. Question
What is the output of re.findall(r”\w+”, “Python 3.10 rocks!”)?
Correct
Incorrect
Question 8 of 15
8. Question
Which pattern matches either “cat” or “dog”?
Correct
Incorrect
Question 9 of 15
9. Question
What is the result of re.sub(r”\d+”, “X”, “My number is 12345”)?
Correct
Incorrect
Question 10 of 15
10. Question
What does ^ represent in regex?
Correct
Incorrect
Question 11 of 15
11. Question
Which function returns all matches as a list?
Correct
Incorrect
Question 12 of 15
12. Question
What will re.split(r”\s+”, “Data Science with Python”) return?
Correct
Incorrect
Question 13 of 15
13. Question
Which regex symbol is used to group expressions?
Correct
Incorrect
Question 14 of 15
14. Question
Which pattern matches a valid 10-digit mobile number?
Correct
Incorrect
Question 15 of 15
15. Question
What is the purpose of re.compile()?
Correct
Incorrect
Summary
These multiple choice questions on Python Regular Expressions strengthen your knowledge of pattern matching, quantifiers, character classes, and the powerful re module. Ideal for interviews, online assessments, and real-world text-processing scenarios.
At QuizOrbit, our team specializes in fun, informative quizzes across topics like general knowledge, technology, and entertainment. Boost your knowledge with our expert-designed quizzes.