On 10/24/07, Andrew Curry <[EMAIL PROTECTED]> wrote:
> ^([a-zA-Z0-9_\-\.]+ # any character repeated from the set memorized into $1
> )@ # followed by an @
> ([a-zA-Z0-9_\-\.]+) # any character repeated from the set memorized into $2
> \.([a-zA-Z]{2,5})$ # any alphabetic character in both cases 2 - 5 in length
> into $3
>
> It looks like it will match an email address
snip

Nope, it looks like it is a naive attempt to match an email address.
This pattern will not match many valid email addresses.  For instance,
[EMAIL PROTECTED] is a valid email address that will fail.  For the
formal definition of an email address's grammar see RFC2822*.  In
general it is a bad idea to write this yourself since there is already
a module that does it for you: Regexp::Common::Email::Address**.

* http://tools.ietf.org/html/rfc2822#section-3.4.1
** 
http://search.cpan.org/dist/Regexp-Common-Email-Address/lib/Regexp/Common/Email/Address.pm

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to