Andras BALI <[EMAIL PROTECTED]> writes:

> Hi.
>
> I'm using latest CVS of BBDB and Gnus with Emacs21. In order to store
> the correct email addresses of people who use TMDA, I use this code:
>
> (defun my-bbdb-normalize-tmda-addresses (addr)
>   "Removes TMDA-related strings from addresses."
>   (when addr
>     (cond ((string-match
>             (concat "\\`\\([^0-9]+\\)\\("
>                       "-dated-[^@]+\\|"
>                       "-sender-[^@]+\\|"
>                       "-[0-9]+\\|"
>                     "\\+[^@]+\\.[^@]+\\)"
>                     "\\(@.*\\)\\'") addr)
>            (concat (substring addr (match-beginning 1) (match-end 1))
>                    (substring addr (match-beginning 3) (match-end 3))))
>           (t addr))))

I'm not sure why you have the backtick (`) in your regexp.  Maybe that
is causing the problem.  Here is the regexp I use (the code is part of
a cond call):

   ((string-match
     "^\\(.+?\\)\\(.\\)dated\\2[0-9]+\\.[0-9a-fA-F]+\\(@.*\\)" addr)
    (concat (match-string 1 addr) (match-string 3 addr)))

The differences between your and mine is:

    . mine is anchored at the beginning of the address with ^.  I
      think this a good idea.

    . Mine matches any string up to XdatedX where X can be any
      character.  This helps when sendmail folks use TMDA and have
      +dated+ in their address.  It'd be easy to have it match sender
      addresses as well.  The "\\(.+?\\)" does a minimal match, so
      it'll find the first XdatedX in the address.

    . When it finds XdatedX, it has to be followed by stuff that looks
      like a TMDA HMAC hash.

Anyway, you might play around with simplifying your regexp, maybe
using some of the ideas that I use in mine.

-- 
Don't send mail to [EMAIL PROTECTED]
The address is there for spammers to harvest.

_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to