Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import re
sentence = '''Sometimes, it is useful to find not just the
first match in a sentence, but every match; the findIter()
method returns an iterator containing every valid match.'''
pattern = re.compile(r'match')
for match in re.finditer(pattern, sentence):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment