From owner-freebsd-questions Wed Jan 2 10:39:22 2002 Delivered-To: freebsd-questions@freebsd.org Received: from lurza.secnetix.de (lurza.secnetix.de [212.66.1.130]) by hub.freebsd.org (Postfix) with ESMTP id D7C1037B417 for ; Wed, 2 Jan 2002 10:39:16 -0800 (PST) Received: (from olli@localhost) by lurza.secnetix.de (8.11.6/8.11.6) id g02IdLG68388; Wed, 2 Jan 2002 19:39:21 +0100 (CET) (envelope-from oliver.fromme@secnetix.de) Date: Wed, 2 Jan 2002 19:39:21 +0100 (CET) Message-Id: <200201021839.g02IdLG68388@lurza.secnetix.de> From: Oliver Fromme To: freebsd-questions@FreeBSD.ORG, smorton@acm.org Reply-To: freebsd-questions@FreeBSD.ORG, smorton@acm.org Subject: Re: Regex Question - email matching In-Reply-To: <3C334E58.7050905@verizon.net> X-Newsgroups: list.freebsd-questions User-Agent: tin/1.5.4-20000523 ("1959") (UNIX) (FreeBSD/4.4-RELEASE (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Simon Morton 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