Showing results for 
Search instead for 
Did you mean: 
Pilot Lvl 1
Message 1 of 2

Question regarding Regular Expressions in Python

Solved! Go to Solution.

Hey everyone 

So I'm learning about regular expressions and I came accross an exercise which is about the email from this line :

x = "From Sat Jan  5 09:14:16 2008"

I already know the solution but I was looking for the "non-greedy" answer which should give me "d@u" as the answer but I can't get it to work. Here's what I've come up with

y = re.findall('\S+?@\S+?',x)

which results in :


Any ideas on what I have to do in order to make it work ?

Thanks !




1 Reply
Pilot Lvl 1
Message 2 of 2

Re: Question regarding Regular Expressions in Python

I was playing with the code and managed to get the result by 

y = re.findall('\S@\S', x)

Which gave me