Examveda

What will be the output of the following code:
import re
pattern = re.compile(r'b[A-Z]+b')
result = pattern.findall('Hello, WORLD!')
print(result)

A. ['Hello', 'WORLD']

B. An error will occur

C. ['Hello,', 'WORLD!']

D. ['H', 'W']

Answer: Option A


This Question Belongs to Python Program >> Regular Expressions In Python

Join The Discussion

Related Questions on Regular Expressions in Python