PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Fri Jul 20, 2018 3:57 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 31 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: Tue Apr 15, 2008 3:50 am 
Offline
Breakbeat Nuttzer
User avatar

Joined: Wed Mar 24, 2004 8:57 am
Posts: 13098
Location: Melbourne, Australia
chandan wrote:
uses this to validate ',' (comma) seperated email addresses. this regular expression not yet performance tuned, but should be good for validating emails.

Expression: ^(\w+(.|_)\w+@\w+\.\w+)(,(\w+(.|_)\w+@\w+\.\w+)|\S)+$
Dont forget to add escape sequence to suit to your env.

-Chandan Benjaram


That regex doesn't verify that the email addresses have a valid syntax in accordance with RFC 2822 like previously posted examples. It simply checks that they look like words with an @ sign in the middle. The (.|_) is pointless by the way. _ is covered by \w anyway, and . simply allows something like a dodgy octet.

The RFC2822 compliance thing I'm not too fussed about since I only check for ascii chars with an @ sign in the middle -- if the user doesn't get my email then they should specify a valid address. But the use of "." makes your validation vulnerable; depending upon it's usage.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 31 posts ]  Go to page Previous  1, 2, 3

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group