in reply to Text Parse Question with RegEx
Trying to parse HTML with regexen will make your life unhappy. Instead use one of the many modules designed to do the job. I recommend HTML::TreeBuilder, although for dealing with tables you might also look at HTML::TableContentParser, HTML::TableParser and a slew of other HTML table munging modules.
Consider:
use strict; use warnings; use HTML::TreeBuilder; # original my $var stuff here my $tree = HTML::TreeBuilder->new; my @lines; $tree->parse ($var); push @lines, $_->as_text () . "\n" for $tree->find ('tr'); print join "\n", @lines[2..4];
Prints:
19th Ave and Eighth Street S.E. Boser and Liker Trail S.E. Lambert and Jerry Drive S.E.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Text Parse Question with RegEx
by Anonymous Monk on Oct 23, 2006 at 22:02 UTC | |
by GrandFather (Saint) on Oct 23, 2006 at 22:07 UTC | |
by blazar (Canon) on Oct 24, 2006 at 13:05 UTC |