Wednesday, September 24, 2008

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>”