programming-examples/python/Regular_Expression/Find the substrings within a string.py
2019-11-15 12:59:38 +01:00

5 lines
172 B
Python

import re
text = 'Python exercises, PHP exercises, C# exercises'
pattern = 'exercises'
for match in re.findall(pattern, text):
print('Found "%s"' % match)