Write a simple regex for email validation? (C# interview questions with answers)
Before reading the interview answer, please go through this Regex video to understand fundamentals of regex with c#.
Email validation can be divided in to three part the first is email user name , domain name and the domain extension.
Step 1(Email user name):- Email user name can start with alphanumeric with minimum 1 character and maximum 10 character. , followed by at the rate (@).
Step 2 ( Domain name) :-The domain name after the @ can be alphanumeric with minimum 1 character and maximum 10 character , followed by a "."
Step 3 ( Domain extension):-Finally should end with .com or .org
The final full email regex validation is below.
Please visit www.questpond.com for 600+ C#/.NET interview questions and answers videos.
Watch our latest video on C# interview questions & answers :-