Functions and their outputs

Report a typo

Suppose you have the following string:

string = "To be, or not to be, that is the question"

Match functions with their possible outputs.

Match the items from left and right columns
re.match('to be', string)
re.findall('be', string)
re.sub('question', 'issue', string)
re.split(',\s', string)
re.search('to be', string)
None
['To be', 'or not to be', 'that is the question']
['be', 'be']
<re.Match object; span=(14, 19), match='to be'>
'To be, or not to be, that is the issue'
___

Create a free account to access the full topic