>>> text = "He was carefully disguised but captured quickly by police."
>>> re.findall(r"w+ly", text)
['carefully', 'quickly']
import re
# regex for finding mentions in a tweet
regex = r"(?<!RTs)@S+"
tweet = '@tony I am so over @got and @sarah is dead to me.'
# mentions = ['@tony', '@got', '@sarah']
mentions = re.findall(regex, tweet)
# A Python program to demonstrate working of findall()
import re
# A sample text string where regular expression is searched.
string = """Todays date is 27 , month is 05 and year is 2022"""
# A sample regular expression to find digits.
regex = 'd+'
match = re.findall(regex, string)
print(match)
# Program to extract numbers from a string
import re
string = 'hello 12 hi 89. Howdy 34'
pattern = 'd+'
result = re.findall(pattern, string)
print(result)
# Output: ['12', '89', '34']