S
Shannon Jacobs
Trying to solve this with a regex approach rather than the programmatic
approach of counting up and down the levels. I have a fairly complicated
HTML page that I want to simplify. I've been able to mung most of it using
several regular expressions, but I've become stuck at this point. I can't
figure out how to grab only the <tr> tags that are associated with tables
that are two levels deep. I feel like I got close, but it seems that
something about the line breaks between the various <table ...> and </table>
tags is still messing me up.
Not sure if the details will help, but I'm actually working in JavaScript
(for convenience). The data is actually train schedules generated from a
database, but I don't have control over the presentation, and that system
lays the timetables out in an almost ridiculous way, with about 4 levels of
table, mostly for trivial effects. I think the ultimate solution is beyond
my capabilities, but in theory, it might be possible to recognize and match
certain key characters in the legend which appears at the bottom and
preserve those key characters during the transformation steps, while still
stripping out the extraneous HTML junk. But there is still a kicker... The
target is a Palm OS device.
For your further amusement, I'll confess that the approach I've been using
to date involves massaging the tables with a spreadsheet. It's actually not
that tedious, but I'm always thinking of easier ways to handle these things.
Macro programming is actually another alternative if the regex approach is
too cumbersome. However, so far the first stages of this approach seemed
pretty smooth...
approach of counting up and down the levels. I have a fairly complicated
HTML page that I want to simplify. I've been able to mung most of it using
several regular expressions, but I've become stuck at this point. I can't
figure out how to grab only the <tr> tags that are associated with tables
that are two levels deep. I feel like I got close, but it seems that
something about the line breaks between the various <table ...> and </table>
tags is still messing me up.
Not sure if the details will help, but I'm actually working in JavaScript
(for convenience). The data is actually train schedules generated from a
database, but I don't have control over the presentation, and that system
lays the timetables out in an almost ridiculous way, with about 4 levels of
table, mostly for trivial effects. I think the ultimate solution is beyond
my capabilities, but in theory, it might be possible to recognize and match
certain key characters in the legend which appears at the bottom and
preserve those key characters during the transformation steps, while still
stripping out the extraneous HTML junk. But there is still a kicker... The
target is a Palm OS device.
For your further amusement, I'll confess that the approach I've been using
to date involves massaging the tables with a spreadsheet. It's actually not
that tedious, but I'm always thinking of easier ways to handle these things.
Macro programming is actually another alternative if the regex approach is
too cumbersome. However, so far the first stages of this approach seemed
pretty smooth...