简体   繁体   中英

How to extract d@u from 'From richard.richrdqwd@uct.za.ca' using non-greedy regular expression?

I'm quite new to regular expressions in Python.

So I'm wondering how can I extract d@u from the text below using non-greedy expressions?

x = 'From richard.richrdqwd@uct.za.ca'

Thank you in advance!

Any suggestion would be appreciated

Try this:

import re
m = re.search('.@.', 'From richard.richrdqwd@uct.za.ca')
if m:
    print(m.group(0))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM