Skip to content

Instantly share code, notes, and snippets.

View HongleiXie's full-sized avatar
🐷

HX HongleiXie

🐷
View GitHub Profile
@HongleiXie
HongleiXie / regex_email_dates.py
Created October 15, 2017 20:04
regex_email_dates.py
import re
email = 'Email: 87hello9__3w4-o.rld@comp.nus.edu.sg where hello_world=wenzy'
out = re.search(r"([a-zA-Z0-9_\.+-]+)@([a-zA-Z0-9-]+)\.([a-zA-Z0-9-\.]+)", email)
# find patterns: all chars including _ . -
print(out.group(0))
print(out.group(1))
print(out.group(2))
print(out.group(3))