------------------------------------------------ On 22 Jul 2003 09:15:29 -0700, James Kelty <[EMAIL PROTECTED]> wrote:
> I know that this is a common request, but I have a question about > parsing an email box. I have a UW IMAP box, and I am trying to extract > all the emails where the line starts with From: blah blah. Now, getting > those lines isn't the issue, but since each email is a little different, > I am having a problem. Given this list, how would I extract JUST the > email address? > > From: "James Kelty" <[EMAIL PROTECTED]> > From: [EMAIL PROTECTED] > From: <[EMAIL PROTECTED]" > > There are three types that I have seen, and I am having the worst time > trying to come up with a regex to extract just the address. Can someone > help with an idea or two? Thanks! > This is a relatively complex task since e-mail addresses can come in so many different forms and contain so many different types of values. Your best bet may be to either use a module for parsing the whole message which is always advised, or look at the source for one of the better message header parsing modules to determine how they are doing it. Sorry this is such a non-specific answer, but rather than suggesting a way to poorly re-invent the wheel, I prefer suggesting that this should be avoided.... http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
