3 ms·
I use the below to extract email addresses. Took from some website some time ago and made super light changes to it. Not sure if this is the best but it has ser
by just_myles 7y ago
I use the below to extract email addresses. Took from some website some time ago and made super light changes to it. Not sure if this is the best but it has served me fairly well.
email_reg = re.compile
(r'''
([a-zA-Z0-9._%+-]+ #First name and last name
@ #@ sign
[a-zA-Z0-9._%+-]+ #domain name
\.[a-zA-Z]{2,10}) #.com
''',re.VERBOSE)
- wwwhizz 7y agoI would not allow the % sign.
- _eht 7y agoYou should allow “$” on the left; as per the RFC...
- just_myles 7y agoWhy I hate regex :) . You think you know it but, you never really do.
- nerdponx 7y agoThat's about the email RFC, not about regex syntax.
- just_myles 7y agoOk cool.