ali raza

C#, .Net ,Asp.net and my thoughts

Regular expression for html Table Parsing

here are some Regular expressions for html parsing . you can use it in your application while parsing html table to fetch data from it

  1.  Table Expression  = “<table[^>]*>(.*?)</table>”  
  2.   Header Expression  = “<th[^>]*>(.*?)</th>”  
  3.   Row Expression  = “<tr[^>]*>(.*?)</tr>”  
  4.   Column Expression  = “<td[^>]*>(.*?)</td>”  

 

3 responses to “Regular expression for html Table Parsing

  1. Petr Fort April 15, 2008 at 2:26 pm

    hi, I have just a small correction to your Header Expression: “]*>”. It will find also the element. I changed the first part to this “]*>|” and works fine, but thanks anyway.

  2. Petr Fort April 15, 2008 at 2:29 pm

    The from cut the regular… but it should to be like this “/]*/>|/”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: