11. What does the function re.match do?
12. What is the output of the following code:
import re
result = re.findall(r'bw+b', 'Hello, world!')
print(result)
import re
result = re.findall(r'bw+b', 'Hello, world!')
print(result)
13. What does the function re.search do?
14. What is the output of the following code:
import re
result = re.search(r'hello', 'Hello, world!', re.IGNORECASE)
print(result.group())
import re
result = re.search(r'hello', 'Hello, world!', re.IGNORECASE)
print(result.group())
15. How can you extract a group from a matched regular expression in Python?
16. What is the purpose of the re.DOTALL flag in Python?
17. What will be the output of the following code:
import re
pattern = re.compile(r'd+')
result = pattern.search('There are 5 apples and 3 oranges.')
print(result.group())
import re
pattern = re.compile(r'd+')
result = pattern.search('There are 5 apples and 3 oranges.')
print(result.group())