I have been using this: (I know, there are probably more efficient ways...)
Given this in an email message:
Submitted data:
First Name: MyName
Your Email Address: email@domain.com
TAG:
I coded this:
intStart = (bodystring.rfind('First ')) + 12
intEnd = (bodystring.rfind('Your Email'))
receiver_name = bodystring[intStart:intEnd]
intStart = (bodystring.rfind('Your Email Address: ')) + 20
intEnd = (bodystring.rfind('TAG:'))
receiver_email = bodystring[intStart:intEnd]
... and got what I needed. This worked because I had the 'TAG'
label.
Now I am given this:
Submitted data:
First name: MyName
Last name:
Email: email@domain.com
I'm having a brain block on getting the email address without a next word. There is whitespace. Can someone nudge me in the right direction? I suspect I can dig out the email address after the occurrence of 'Email:'
using regex...