nanog mailing list archives
Re: Programmers with network engineering skills
From: Keegan Holley <keegan.holley () sungard com>
Date: Mon, 12 Mar 2012 23:01:57 -0400
On Mar 12, 2012, at 5:32 PM, Owen DeLong <owen () delong com> wrote:
On Mar 12, 2012, at 2:12 PM, Keegan Holley wrote:2012/3/12 Tei <oscar.vives () gmail com>On 12 March 2012 09:59, Carlos Martinez-Cagnazzo <carlosm3011 () gmail com> wrote:Hey! On 3/8/12 8:24 PM, Lamar Owen wrote:On Monday, March 05, 2012 09:36:41 PM Jimmy Hess wrote: ...(16) The default gateway's IP address is always 192.168.0.1 (17) The user portion of E-mail addresses never contain special characters like "-" "+" "$" "~" "." ",", "[", "]"I've just had my ' xx AT cagnazzo.name' email address rejected by a web form saying that 'it is not a valid email address'. So I guess point (17) can be extended to say that 'no email address shall end in anything different that .com, .net or the local ccTLD' :=) CarlosYea, I don't even know how programmers can get that wrong. The regex is not even hard or anything. (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])I bet it's even harder without the use of a search engine.Whenever I've built code to check someone's email address on a form, I always just looked for the following: 1. matches ^[^@]+@[A-Za-z0-0\-\.]+[A-Za-z]$ 2. The component to the right of the @ sign returns at least one A, AAAA, or MX record. If it passed those two checks, I figured that was about as good as I could do without resorting to one of the following: 1. An incomprehensible and unmaintainable regex as the one above 2. Actually attempting delivery to said address Owen
I've done some scripting with the similar goals and to be completely honest I've skews at least consulted google. It's much easier to read and test a regular expression like the one above than to write one from scratch. Sometimes it takes an incomprehensible regex to be thorough. Sometimes close enough really is close enough though. It depends on the problem you are trying to solve.
Current thread:
- Re: Programmers with network engineering skills, (continued)
- Re: Programmers with network engineering skills Owen DeLong (Mar 12)
- Re: Programmers with network engineering skills Joe Greco (Mar 12)
- Re: Programmers with network engineering skills Mark Andrews (Mar 12)
- Re: Programmers with network engineering skills Joe Greco (Mar 13)
- Re: Programmers with network engineering skills Jimmy Hess (Mar 16)
- Re: Programmers with network engineering skills Jeroen van Aart (Mar 12)
- Re: Programmers with network engineering skills Aled Morris (Mar 13)
- Re: Programmers with network engineering skills Joe Greco (Mar 13)
- Re: Programmers with network engineering skills Steve Bertrand (Mar 13)
- Re: Programmers with network engineering skills Jeroen van Aart (Mar 16)
- Re: Programmers with network engineering skills Keegan Holley (Mar 12)
- Re: Programmers with network engineering skills Paul Graydon (Mar 12)
- Re: Programmers with network engineering skills Owen DeLong (Mar 12)
- Re: Programmers with network engineering skills Carlos Martinez-Cagnazzo (Mar 13)
- Email Integration / Account Migration Mike Rae (Mar 13)
- Re: Email Integration / Account Migration Mike Lyon (Mar 13)
- Re: Email Integration / Account Migration Anurag Bhatia (Mar 13)
- Re: Email Integration / Account Migration Thomas King (Mar 14)