()
| 34 | |
| 35 | |
| 36 | def EmailCheck(): |
| 37 | # Regular expression for matching email addresses |
| 38 | emailCheck = re.compile( |
| 39 | r""" |
| 40 | ([a-zA-Z0-9._%-]+ # username |
| 41 | @ # @ character |
| 42 | [a-zA-Z0-9_-]+ # domain name |
| 43 | \. # .(dot) |
| 44 | [a-zA-Z]{2,3} # domain type |
| 45 | (\.[a-zA-Z]{2,3})?) # second domain type like co.in |
| 46 | """, |
| 47 | re.VERBOSE, |
| 48 | ) |
| 49 | |
| 50 | # Loop through the email addresses found in the text |
| 51 | for emails in emailCheck.findall(text): |
| 52 | matches.append(emails[0]) |
| 53 | |
| 54 | |
| 55 | # Print the output from matches list |