Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PY4E - Regular Expressions (Chapter 11 Part 2) video #235

Open
omicron-b opened this issue Mar 31, 2020 · 0 comments
Open

PY4E - Regular Expressions (Chapter 11 Part 2) video #235

omicron-b opened this issue Mar 31, 2020 · 0 comments

Comments

@omicron-b
Copy link

Hello, team!

I am confused here at 5:56-6:11
https://youtu.be/fiar4QZZ7Xo?t=356
Dr. Chuck says here that a non-greedy regex would produce d@u
But how would you do a non-greedy regex here?

>>> str = "from example@some.domain Sat Jan 5 09"
>>> nongreedy = re.findall('\S+?@\S+?', str)
>>> greedy = re.findall('\S+@\S+', str)
>>> greedy
['example@some.domain']
>>> nongreedy
['example@s']

What I expected to be non-greedy still takes a whole example part.

P.S. Thanks a lot for a very interesting and insightful course! I am going through after almost completing 2 books on Python and remember / find something beautiful or very useful even in earlier parts. Also, Dr. Chuck's videos are super easy to follow and understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant