Parsing a free-rorm field looking for an email address
Fairlight
fairlite at fairlite.com
Thu Jan 26 12:40:23 PST 2006
>From inside the gravity well of a singularity, Mike Schwartz (PC Support & Services, Appleton, WI) shouted:
> Does anybody have a routine that parses a free-form line looking for
> an email address in it? I thought somebody posted a routine that did
> this a while ago.
Nothing handy here, but it could be done relatively quickly by just about
anyone--depending on how you're determining "email address".
If you mean simply the "user@[some.]domain.TLD" format, sure, that's
relatively easy to write.
If you want full RFC-822 compliance, that's going to take a bit to write,
recognising bangpaths, user%host at host pathing, and any of the other myriad
address formats out there.
Personally, even I only use the simple format for validation. There's a
perl module that would let me validate for RFC-822 compliance, but I never
use it, as I consider it overkill. When even UUCP hosts started going to
domain syntax, that's when I stopped really bothering to look at anything
else.
But again--one technically probably -should-. Even me. I just don't. :)
But I'd hate for you to want 822 compliance and only be given a simple
match routine that catches the common form.
mark->
More information about the Filepro-list
mailing list