TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ahsan Abbas
NA
15
3.1k
Email Extraction from webs
Apr 3 2014 12:48 PM
I want to extract email address from html pages, here is my code which runs perfectly but the problem is it's extracts only one email id not multiple, which means it's not passing through any loop, can any tell me where can i put loop in the code.
private void btnURL_Click(object sender, EventArgs e)
{
string url = boxURL.Text;
WebRequest request = WebRequest.Create(url);
WebResponse response = request.GetResponse();
Stream data = response.GetResponseStream();
StreamReader sr = new StreamReader(data);
string html = sr.ReadToEnd();
//string regex = "\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b";
string regex = @"[\w-]+@([\w-]+\.)+[\w-]+";
System.Text.RegularExpressions.Regex ex = new System.Text.RegularExpressions.Regex(regex, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
string Email = ex.Match(html).Value.Trim();
boxEmail.Text = Email;
}
Reply
Answers (
1
)
Is it a bad practice to reference an exe file in C# project
Stopwatch adherent to the reading of membership's card