1. Which of the following functions results in case-insensitive matching? A. re.
ID: 3733859 • Letter: 1
Question
1. Which of the following functions results in case-insensitive matching? A. re.A B. re.U C. re.I D. re.X
2.
What does the function re.match do?
Matches a pattern at the start of the string
Matches a pattern at any position in the string
Return a list of matches in the string
Such a function does not exist in Python
3.
What is the output of the following function?
re.findall("hello world", "hello", 1)
["hello"]
[]
hello
hello world
A.Matches a pattern at the start of the string
B.Matches a pattern at any position in the string
C.Return a list of matches in the string
D.Such a function does not exist in Python
3.
What is the output of the following function?
re.findall("hello world", "hello", 1)
A.["hello"]
B.[]
C.hello
D.hello world
Explanation / Answer
Answer1) C. re.I
Explanation: I stands for IGNORECASE.
Answer2) A.Matches a pattern at the start of the string
Explanation: it attempts the pattern at the very start of the string.
Answer3) B. []
Explanation: findall function will return an array of all non-overlapping regex matches in the string.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.