Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of rob_au (1845)

Monday July 21, 2003
12:54 AM

Matching email addresses

[ #13584 ]
Matching email addresses with regular expressions is a complex task - The easiest way to go about doing this is to use the massive regular expression which Jeff Friedl demonstrates the construction of in Mastering Regular Expressions.

I found today that sometimes this level of matching is overkill - The scenario was a PHP form where a users' email address is specified. The regular expression from Mastering Regular Expressions worked nicely, but because the RFC allows for the specification of addresses by local username alone, "invalid" email addresses could still be provided. The work around was to edit the source of the regular expression constructor script so that only the addr_spec portion of the RFC specified address specification was matched.

There was of course, no way I was going to edit the regular expression directly - Have you see that thing? :-)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.