I have a large collection of html pages, all having html tables that I need to extract. Some of the pages have a single table. Others have nested tables, up to four layers.
1) If the file has only 1 table, I need to extract that table into a variable (I know I could do something like http:Q_21758443.html
or by using preg_match); but
2) If the file has nested tables, I need only the innermost table.
In other words, no matter whether the html file has only 1 table, or nested tables, it should always extract the innermost table. How is this done?