Python: Regex re.finditer

By Xah Lee. Date: . Last updated: .
re.finditer(regex, text)
Similar to re.findall , except an “iterator” is returned with MatchObject as members. This is to be used in a loop.
re.finditer(regex, text, flags=flags)
With Flags.
import re

for matched in re.finditer(r'(\w+)', 'what   do  you think'):
    print(matched.group())
# prints each word in a line

Python, Regex Functions

Python, Regular Expression