I have created this blog to help programmers who have just started their career thats why I have written all the tutorials from practical approach rather then theoretical. If anyone has any query related to programming don't hesitate to ask. My contact information is in my profile. Also I would like to thank all the websites/Individual(s) from whom I gathered the material.
Wednesday, August 10, 2011
How to Find All Email Address in a Text File
using System.Text.RegularExpressions;
using System.IO;
string FileData = File.ReadAllText(fileName);
Regex emailregex = new Regex("(?<user>[^@]+)@(?<host>.+)");
MatchCollection matches = emailregex .Matches(FileData);
foreach (Match match in matches)
{
Console.WriteLine(match.Value.ToString());
}
Posted by
Zeeshan Ahmed Khan
at
8/10/2011 02:32:00 PM
Labels:
C#,
email,
file,
find all email address,
regex
Subscribe to:
Posts (Atom)