Correct Answer : Option (A)
Correct Answer : Option (C)
sentence = 'we are humans' matched = re.match(r'(.*) (.*?) (.*)', sentence) print(matched.groups())
Correct Answer : Option (B)
sentence = 'we are humans' matched = re.match(r'(.*) (.*?) (.*)', sentence) print(matched.group(2))
Correct Answer : Option (D)
sentence = 'horses are fast' regex = re.compile('(?P<animal>\w+) (?P<verb>\w+) (?P<adjective>\w+)') matched = re.search(regex, sentence) print(matched.groups())
re.split('\W+', 'Hello, hello, hello.')