?
Solved

Parsing html row with a regular expression

Posted on 2006-05-21
4
Medium Priority
?
248 Views
Last Modified: 2010-04-16
Hi, I 'm trying to parse these two rows out with a regular expression... But I have not been able to come up with an expression? The only thing that is known is that Footer Note will ALWAYS be present.

<TR>
          <TH something in here>Footer Note</TH></TR>
        <TR>
          <TD something in here could be anything> SOME Text in here could be anything</TD></TR>
0
Comment
Question by:dotnet22
  • 2
4 Comments
 
LVL 10

Expert Comment

by:prakash_prk
ID: 16731664
what do u really want to extract from this content?
0
 

Author Comment

by:dotnet22
ID: 16734247
From the first  <TR> to the last </TD></TR>
0
 
LVL 14

Accepted Solution

by:
Shiju Sasidharan earned 2000 total points
ID: 16736097
       private void button1_Click(object sender, EventArgs e)
            {
             string  s;
             s = @"<TR><TH something in here>Footer Note</TH></TR>";
             s+= @"<TR><TD something in here could be anything>";
             s+= @"SOME Text in here could be anything</TD></TR>";
             ExtractTr(s);
            }
        private void ExtractTr(string HtmlData)
            {
                string sPattern;
                sPattern = @"<tr[\s\S]*?>[\s\S]*?</tr>";
                foreach(Match oItem in Regex.Matches(HtmlData,sPattern,RegexOptions.IgnoreCase))
                    {
                    MessageBox.Show(oItem.Value.ToString());
                    }
            }
0
 
LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 16736101
also insert namespace

using System.Text.RegularExpressions;
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month15 days, 5 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question