31. What will be the output of the following Python code?
re.escape('new**world')
re.escape('new**world')
32. Which of the following functions results in case insensitive matching?
33. Which of the following will result in an error?
34. The expression a{5} will match . . . . . . . . characters with the previous regular expression.
35. What is the purpose of the re.VERBOSE flag in Python?
36. What will be the output of the following Python code?
m = re.search('a', 'The blue umbrella')
m.re.pattern
m = re.search('a', 'The blue umbrella')
m.re.pattern
37. 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())
sentence = 'horses are fast'
regex = re.compile('(?P<animal>\w+) (?P<verb>\w+) (?P<adjective>\w+)')
matched = re.search(regex, sentence)
print(matched.groupdict())
38. What will be the output of the following Python code?
re.match('sp(.*)am', 'spam')
re.match('sp(.*)am', 'spam')
39. How can you specify a range of characters in a character class in regular expressions?
40. What will be the output of the following Python function?
re.findall("hello world", "hello", 1)
re.findall("hello world", "hello", 1)