How can you fetch email ids from text using python and regular expression

Spread the love

In this tutorial, you will learn how to write a program to fetch email ids from text using python and regular expression

#python code

import re line = "if you ahve any query send an email to test@gmail.com" match = re.search(r'[\w\.-]+@[\w\.-]+', line) print(match.group(0))

Output:

test@gmail.com

If you have any alternative methods or procedures for same requirement, you can comment below.

admin

admin

Leave a Reply

Your email address will not be published. Required fields are marked *