I am currently learning Python and was playing around with regex. I have noticed that I can't make sense of using regex non-greedy, if it isn't in or before the end of a pattern.
x = "From someone.name@gmail.com Sat Jan 5 09:14:16 2008"
y = re.findall('\S+?@\S+' , x)
This would give me:
someone.name@gmail.com
Whereas this:
x = "From someone.name@gmail.com Sat Jan 5 09:14:16 2008"
y = re.findall('\S+@\S+?' , x)
or
y = re.findall('\S+?@\S+?' , x)
Would be:
someone.name@g
So is there any point in using non-greedy regex if it isn't the in or before the end of a pattern?