Skip to content

Instantly share code, notes, and snippets.

@JeffersGlass
Created January 3, 2021 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeffersGlass/cff561b3b6b20faff09688ac60affa27 to your computer and use it in GitHub Desktop.
Save JeffersGlass/cff561b3b6b20faff09688ac60affa27 to your computer and use it in GitHub Desktop.
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):
print(match)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment