The function re.error raises an exception if a particular string contains no match for the given pattern.
Select an option to see the answer and solution.
What will be the output of the following Python code?
re.split('\W+', 'Hello, hello, hello.')
Select an option to see the answer and solution.
. . . . . . . . matches the start of the string.
. . . . . . . . matches the end of the string.
Select an option to see the answer and solution.
What is the output of the following code:
import re
result = re.search(r'd{2}', 'There are 25 apples and 3 oranges.')
print(result.group())
Select an option to see the answer and solution.
What will be the output of the following Python code?
re.compile('hello', re.X)
Select an option to see the answer and solution.
What will be the output of the following Python code?
re.subn('A', 'X', 'AAAAAA', count=4)
Select an option to see the answer and solution.
What is the purpose of the re.findall() function in Python?
Select an option to see the answer and solution.
Which of the following functions clears the regular expression cache?
Select an option to see the answer and solution.
What will be the output of the following Python code?
re.split(r'\s+', 'Chrome is better than explorer', maxspilt=3)
Select an option to see the answer and solution.
What will be the output of the following Python code?
import re
re.ASCII
Select an option to see the answer and solution.
What will be the output of the following Python code?
re.escape('new**world')
Select an option to see the answer and solution.
Which of the following functions results in case insensitive matching?
Select an option to see the answer and solution.
Which of the following will result in an error?
Select an option to see the answer and solution.
The expression a{5} will match . . . . . . . . characters with the previous regular expression.
Select an option to see the answer and solution.
What is the purpose of the re.VERBOSE flag in Python?
Select an option to see the answer and solution.
What will be the output of the following Python code?
m = re.search('a', 'The blue umbrella')
m.re.pattern
Select an option to see the answer and solution.
What will be the output of the following Python code?
sentence = 'horses are fast'
regex = re.compile('(?P<animal>\w+) (?P<verb>\w+) (?P<adjective>\w+)')
matched = re.search(regex, sentence)
print(matched.groupdict())
Select an option to see the answer and solution.
What will be the output of the following Python code?
re.match('sp(.*)am', 'spam')
Select an option to see the answer and solution.
How can you specify a range of characters in a character class in regular expressions?
Select an option to see the answer and solution.
What will be the output of the following Python function?
re.findall("hello world", "hello", 1)
Select an option to see the answer and solution.