NEW
Font size
WorksheetsLECTURE 10 (09.12.2025)
Total questions: 20
Worksheet time: 10mins
True or False: In Python, the re module helps you use regular expressions.
True
False
What does "RegEx" stand for?
Regular Expressions
Regular Example
Register Exit
Region Extra
True or False: The "+" symbol in RegEx means "zero or more times".
True
False
Which symbol in RegEx means "zero or more times"?
+
*
?
$
True or False: The pattern \w matches any letter, number, or underscore.
True
False
What is an API?
A set of rules for programs to talk to each other
A type of database
A web browser
A programming language
Which Python web framework is simple and good for making APIs?
Flask
Django
React
Node
True or False: Greedy matching in RegEx tries to match as much text as possible.
True
False
Which pattern will match the smallest amount of text between two tags, like in "text"?
.*
.*?
.+
.?
Which RegEx pattern matches exactly one digit?
\d
\d+
\d*
\w
True or False: The "^" symbol in RegEx matches the start of a string.
True
False
Which pattern matches one or more word characters (letters, numbers, or underscore)?
\w*
\w+
\w?
\d+
If you want to match a real period (.) in text, which pattern should you use?
.
\.
[.]
\d
Which of these is NOT a RegEx quantifier?
*
+
?
@
Which function in Python's re module finds all matches in a string?
re.match()
re.findall()
re.compile()
re.replace()
Write a Python RegEx pattern to match any three-letter word ending with "at" (like "cat", "bat", "rat"). Try your pattern in a Python compiler. Which pattern works?
.at
[a-z]at
\wat
[^ ]at
Write a Python RegEx pattern to get all numbers from the string "abc123xyz456". Try it in a Python compiler. Which pattern works?
[a-z]+
\d+
\w+
[0-9a-z]+
True or False: The "$" symbol in RegEx matches the end of a string.
True
False
Write a RegEx pattern to match a string that starts with "API" and ends with a digit. Try it in a Python compiler. Which pattern works?
^API\d$
API\d
^API.*\d$
^API\d.*
Make your own RegEx pattern to match any word that starts with "a" and ends with "z" (like "abz", "amazingz"). Try it in a Python compiler. Which pattern works?
a.*z
^a.*z$
a.z
^az$
