Shane McElwee wrote:
> 
> Below I've a regular expression that checks the syntax of an email address.
> The problem I'm having is with the underscore "_".

The \w character class includes the underscore character (\w eq
[a-zA-Z0-9_])

> I've tried some
> different forms of syntax but I know its something simple I'm missing. I
> think I've been looking at it too long. The validator should allow usernames
> with periods and underscores. Any ideas?
> 
> next if (!/^[\w][\w\._-]*@[\w\.-]+$/)
                           ^^
perl is interpolating the variable @[ which is probably undefined.  You
_are_ running with "use strict" and "use warnings" aren't you?

next unless /^\w[\w.-]*\@[\w.-]+$/;


BTW, have you read the FAQ "How do I check a valid mail address?" in
perlfaq9?


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to