Hi Monks, Here's yet another simple task that is confounding me. I sent out an emailer to a list of clients. It had been a while sine the owner had used the list, so not suprisingly, there were a lot of bounces. I congealed the bounced addresses into a file bad_emails from the address book, and wrote a little ditty to turn the paragraph style collage into a nice neat column. I also will have to do dup removals, once I get the (explicitive) thing to match more than one email address per line.

The next task is to compare the list to the original list and remove the matches: raw list - bad list = good list.

But before I can do that, I need to fix my regex, as it seems to only match the first one in each line. I obviously don't have the grasp of /g I thought I did.

push (@list, "$1\n") and $count++ if /\b([\w]+@[\w]+\.[\w]{3})\b/g;
Why am I only getting 1 match per line? Heres a smaple line from the data file:

wings@yahoo.com <wings@yahoo.com>; wine@hotmail.com <wine@hotmail.com>;


In reply to scripty email address regex stuff by mkahn

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.