Date: Wed, 2 Jan 2002 19:39:21 +0100 (CET) From: Oliver Fromme <olli@secnetix.de> To: freebsd-questions@FreeBSD.ORG, smorton@acm.org Subject: Re: Regex Question - email matching Message-ID: <200201021839.g02IdLG68388@lurza.secnetix.de> In-Reply-To: <3C334E58.7050905@verizon.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Simon Morton <simon.morton@verizon.net> wrote: > if ( $email =~ /^([\w\.\-]+)\@([\w\.\-]+)\.([[:alpha:]]+)$/ ) { > [...] > } else { > print "Invalid email address\n"; Then you would be rejecting a lot of valid addresses. For example, they can contain "+". On the other hand, it would accept "_" in domain names which is illegal. Please -- if someone is accepting or rejecting email addresses based on some regular expression, _PLEASE_ read RFC 2822 first, and in particular section 3.4 titled "address specification". Otherwise you might cause some trouble and grief to your users. The format of valid email addresses is more complicted than many people think. Regards Oliver -- Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "All that we see or seem is just a dream within a dream" (E. A. Poe) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201021839.g02IdLG68388>