There is what re.VERBOSE is made for splitting up long regex and eg adding comments.
import re email = re.compile(r""" [\w.]+ # match any alphanumeric character or a period @ # match the character literally \w+\.[a-z]{3} # Any character followed by period and exactly three lower-case letters""", re.VERBOSE) print(email.findall('[email protected] [email protected]')
Output:['[email protected]']
The same as.import re email = re.compile(r'[\w.]+@\w+\.[a-z]{3}') print(email.findall('[email protected] [email protected]'))
Output:['[email protected]']