Python: regular expressions

Parentheses are not part of the match, but tell you where to start and stop the extraction you want to do:

re.findall(‘^From: (\S+@\S+)’, input_var)

Having this kind of string: From: metireatumadre@milf.co.uk

Will stract: metireatumadre@milf.co.uk
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s