In this example we will show how to get all matches using the findall() function in Python.
Source Code
import re
# imported the re module, you can start using regular expressions
str1 = 'I love Python'
r = re.findall('o', str1)
print(r)
Output:
['o', 'o']