Regex to find tables in html

fenris

Member
Joined
Sep 9, 2002
Messages
22
Location
Canada
Hi all, I am trying to develop a routine that will allow me to feed it an html string and have it return a collection of string arrays representing all the tables that where found.

I have this regular expression:

Code:
<table[^>]*>[\w|\t|\r|\W]*</table>


Below is a snippet of where I am. I am unsure how to proceed.
Code:
Dim sTablePattern As String = "<table[^>]*>[\w|\t|\r|\W]*</table></center>" This expression grabs the table from the html

        Dim regex As New regex(sTablePattern, RegexOptions.IgnoreCase Or RegexOptions.Multiline Or RegexOptions.IgnorePatternWhitespace Or RegexOptions.Compiled)
        Dim om As Match = regex.Match(sHtml)


Ultimately I would like to feed it different websites like this or this and have a collection of 2d string arrays (the array would hold the string elements of the table).

Any help would be greatly appreciated. Thanks!

BTW, I am using vb.net 2003
 

Similar threads

Back
Top