in reply to Re: Text Parse Question with RegEx
in thread Text Parse Question with RegEx

The problem is that this data is contained on many different pages and will show up in different rows. The HTML also varies around the rows I want.

They only thing that the data has, from which I can parse by, is that 'and' is in the row and the row HTML doesn't have a <br> in it.

Replies are listed 'Best First'.
Re^3: Text Parse Question with RegEx
by GrandFather (Saint) on Oct 23, 2006 at 22:07 UTC

    so the following probably is what you want:

    # ... as for first sample my $tree = HTML::TreeBuilder->new; $tree->parse ($var); for ($tree->find ('tr')) { next unless $_->as_text () =~ /\band\b/; next if $_->find ('br'); print $_->as_text () . "\n"; }

    Prints:

    19th Ave and Eighth Street S.E. Boser and Liker Trail S.E. Lambert and Jerry Drive S.E.

    DWIM is Perl's answer to Gödel
Re^3: Text Parse Question with RegEx
by blazar (Canon) on Oct 24, 2006 at 13:05 UTC
    The problem is that this data is contained on many different pages and will show up in different rows. The HTML also varies around the rows I want.

    One more reason for not wanting to use regexen and adopt a solution based on a proper HTML parser instead, just as GrandFather suggested.