turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- GitHub Community Forum
- :
- Conversations
- :
- Programming Help and Discussion
- :
- Question regarding Regular Expressions in Python

Options

- Subscribe to RSS feed
- Mark all as new
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer friendly page

Copilot Lvl 3

Wednesday

- Mark as new
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Message 1 of 2

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 stephen.marquard@uct.ac.za 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) print(y)

which results in :

['stephen.marquard@u']

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

Thanks !

Solved! Solved! Go to Solution.

1 Reply

Solution

Copilot Lvl 3

Thursday

- Mark as new
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Message 2 of 2

New solutions