On 02/08/07, CK <ck@xxxxxxxxxxxxxxx> wrote: > Hi > > Please see the notes below keeping in mind this RegEX is being used > to validate emails for a newsletter signup form. It may not be > possible, accommodating some of the formats you provided. If you have > the "Holy Grail" of RegEx please share. Can you reply to the list please? It's exactly the kind of situation that's most annoying - when you try and sign up for a newsletter or register with a site and it refuses to let you because it reckons your email address is invalid, despite the fact you've been sending and receiving mail with it for years. The best advice for validating email addresses is don't do it with a regexp. Send an email to the address with a link in it for them to confirm their registration. > On Aug 1, 2007, at 11:08 PM, Robin Vickery wrote: > > > On 02/08/07, CK <ck@xxxxxxxxxxxxxxx> wrote: > >> Hi, > >> > >> Would you point out why? As I've tested a range of email address, > >> and have not found one rejected that is formatted correctly. > > > > ok, here's a few perfectly valid email addresses off the top of my > > head. The first one's especially annoying as I use it a lot. The last > > one's not so common but can be useful if you've got broken dns. > > > > robinv+php@xxxxxxxxx > (would you give a hand in accommodating this format?) Yeah, get rid of the regexp completely. Simple eh? > > name@xxxxxxxxxxxxxx > (should be invalid as the domain does not exist) Of course it doesn't - it's an example. that's why the example.museum domain is reserved - to use in examples like this. The point is your regexp won't let anyone with a perfectly valid .museum (or .travel) domain register with your newsletter. > > o'reilly@xxxxxxxxxxx > (should be invalid as the domain does not exist) Of course it doesn't - it's an example. that's why the example.com domain is reserved - to use in examples like this. The point is that your regexp won't allow anyone with an apostrophe in their name: o'reilly, o'rourke, o'malley etc. > > > name@[127.0.0.1] > (would you give a hand in accommodating this format?) -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php