Re: [ot] extended posix regexp for email address
First off, this is way OT for debian-devel. Pick up a copy of Friedl's
_Mastering Regular Expressions_ to learn more about RE.
On Fri, 20 Feb 2004, Grovel wrote:
> Please help, I'm writing C program using <regex.h>.
>
> I need to know the basic or extended posix regexp for a valid email
> address. I can't use perl regex (don't want the dependency on
> perl).
You (in general) don't want to be writing a regex to validate email
addresses.
> I'm guessing it's:
>
> [a-z0-9-+_.]+@[a-z0-9-+_.]+\.[a-z0-9-+_.]+ [with REG_ICASE]
And no, it most definetly is not.
Until you've read and understood the monstrosity that is the regexp in
Email::Valid[1], you should stay well away from writing your own regex to
validating email addresses. Consider using someone else's library to
do the same.
Don Armstrong
1: which doesn't even validate all RFC 2822 addresses correctly.
--
I now know how retro SCOs OSes are. Riotous, riotous stuff. How they
had the ya-yas to declare Linux an infant OS in need of their IP is
beyond me. Upcoming features? PAM. files larger than 2 gigs. NFS over
TCP. The 80's called, they want their features back.
-- Compactable Dave http://www3.sympatico.ca/dcarpeneto/sco.html
http://www.donarmstrong.com
http://www.anylevel.com
http://rzlab.ucr.edu
Reply to: