I want char only domain name expression for email,dont want allow digits and spl chars in domain name.
eg:
[email protected]
not like these
[email protected]
[email protected]
[email protected]
[email protected]
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Joginder BangerRank #360 · 7K reputationPosted Nov 14, 2014, 9:49 PM EST
try this link
https://dotnetfiddle.net/4wgpJQ
Joginder BangerRank #360 · 7K reputationPosted Nov 14, 2014, 8:47 PM EST
public class program
{
public bool emailcheck(string emailid)
{
bool temp = false;
Regex reg = new Regex(@"^[A-Z-]+@[A-Z]+\.[A-Z]{2,4}$", RegexOptions.IgnoreCase);
if (reg.IsMatch(emailid))
temp = true;
return temp;
}
// empcode,empname,dob,dept,bloodgroup
public static void Main(string[] args)
{
program obj = new program();
Console.WriteLine( obj.emailcheck("[email protected]")); //true
Console.WriteLine(obj.emailcheck("[email protected]")); //false
Console.WriteLine(obj.emailcheck("[email protected]")); //false
Console.WriteLine(obj.emailcheck("jogi@g%mail.com")); false
Console.WriteLine(obj.emailcheck("[email protected]")); false
}
}
check online
https://dotnetfiddle.net/4wgpJQ
Joginder BangerRank #360 · 7K reputationPosted Nov 14, 2014, 9:33 PM EST
"^[a-zA-Z-]+@[a-zA-Z]+\.[a-zA-Z]{2,4}"
i enter only capital condition but you are enter the small letter also.
Joginder BangerRank #360 · 7K reputationPosted Nov 16, 2014, 8:42 PM EST
Dawood AbbasRank #6,413 · 267 reputationPosted Nov 14, 2014, 9:05 PM EST
not working for actual email [email protected]
Joginder BangerRank #360 · 7K reputationPosted Nov 14, 2014, 9:09 PM EST
https://dotnetfiddle.net/4wgpJQ
Dawood AbbasRank #6,413 · 267 reputationPosted Nov 14, 2014, 9:17 PM EST
below i attached that page.
Dawood AbbasRank #6,413 · 267 reputationPosted Nov 14, 2014, 9:39 PM EST
[email protected]
Dawood AbbasRank #6,413 · 267 reputationPosted Nov 16, 2014, 9:22 PM EST
Azaad Abbas127 reputationPosted Nov 17, 2014, 8:07 PM EST
can u plz some more expressions provide me,I tried from searching on google.
1)Phone
like
(country code)(10 dgits) eg:+919000000000
if miss country code then error message display 'plz provide country code' and othervise display 'invalid no'
2)Marks
like
0-100 digits can only enter..not above 100 like 101...200....
3)AcademicYear
like
yyyy-yyyy
4)Tax
5)Shift
6)fax
like
+(country code)-(area code)-(fax number)
for example: +1-212-9876543 and with error message,if miss '-' then show 'missing '-'', if missing '+' then show 'missing '+''.
at least cant find country code and area code?
if miss country code then display 'plz provide country code'
if miss area code then display 'plz provide area code'?