import re
list = ["Aimtocode", "Python", "Java", "C", "C++"]
for element in list:
z = re.match("(g\w+)\W(g\w+)", element)
if z:
print((z.groups()))
patterns = ['Aimtocode', 'Python']
text = 'Learning Python at Aimtocode'
for pattern in patterns:
print('Looking for "%s" in "%s" ->' % (pattern, text), end=' ')
if re.search(pattern, text):
print('found a match!')
else:
print('no match')
abc = '
[email protected],
[email protected],
[email protected]'
emails = re.findall(r'[\w\.-]+@[\w\.-]+', abc)
for email in emails:
print(email)