patch: e-mail extraction

2002-02-23 13:17:38
I slightly modified &extract_email_address from (v.2.5.2) with a
more rigorous regular expression check, to handle slightly misformed From

This corrected a problem I had with a malformed From header of the form:

  From: Joe Schmoe" <joe(_at_)schmoe(_dot_)com

Ugh.  Gotta love those MUAs. :-)

The diff is:

<     if ($str =~ /<(\S+)>/) {
    if ($str =~ /([\w\-\(_dot_)]+\(_at_)[\w\-\(_dot_)]+)/) {
        $ret = $1;
    elsif ($str =~ /<(\S+)>/) {

Basically, as a first check, it tries to extract a string of the form:

  [alphanumeric, '_', '-', '.']+\(_at_)[alphanumeric, '_', '-', '.']+

If it doesn't find anything like that, it goes through the other checks.


+=== Eugene Eric Kim ===== eekim(_at_)eekim(_dot_)com ===== ===+
|       "Writer's block is a fancy term made up by whiners so they        |
+=====  can have an excuse to drink alcohol."  --Steve Martin  ===========+

<Prev in Thread] Current Thread [Next in Thread>
  • patch: e-mail extraction, Eugene Eric Kim <=