I'm trying to match the lines in the bottom three HTML rows. The first row is matching and returning nothing, and returning an empty list element to the @results array.

1. Why is the first HTML row matching?

It has <br> in there and it's not specified in my regex.

2. How do I only match text with 'and' in there? @results should have only the three last rows and three list elements.

@results should look like:
$VAR1 = '19th Ave and Eighth Street S.E.'; $VAR2 = 'Boser and Liker Trail S.E.'; $VAR3 = 'Lambert and Jerry Drive S.E.';

My Try:
#!/usr/bin/perl -w use strict; use Data::Dumper; my $var = qq( <tr> <td width="651" height="48"><br> This community is grat and has lots to offer.</td> </tr> <tr> <td width="651" height="16">Southeast</td> </tr> <tr> <td width="351" height="9">&nbsp;19th Ave and Eighth Street S.E. +</td> </tr> <tr> <td width="351" height="6">&nbsp;Boser and Liker Trail S.E.</td> </tr> <tr> <td width="351" height="6">&nbsp;Lambert and Jerry Drive S.E.&nb +sp;</td> </tr> ); my @results = $var =~ m/>[&nbsp;]?(.*?)[&nbsp;]?</g; print Dumper @results;

In reply to Text Parse Question with RegEx by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.