extract email address using expression in django

import re

# Assuming you have a string containing text that may include email addresses
text_with_emails = "Your text containing email addresses goes here"

# Define a regular expression pattern for extracting email addresses
email_pattern = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'

# Use the findall method from the re module to extract email addresses from the text
extracted_emails = re.findall(email_pattern, text_with_emails)

# Print or use the extracted email addresses as needed
print(extracted_emails)