Python
# Program to validate email format using regex
import re
email = input("Enter an email address: ")
pattern = r"^[\w\.-]+@[\w\.-]+\.\w+$"
if re.match(pattern, email):
print("Valid email format")
else:
print("Invalid email format")Output
Enter an email address: [email protected] Valid email format
We use a simple regular expression to approximate valid email structure: [email protected]. This demonstrates pattern matching and basic input validation with regex.