Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Simple e-mail validation

by eXile (Priest)
on Jun 04, 2004 at 14:12 UTC ( [id://360880]=note: print w/replies, xml ) Need Help??


in reply to Simple e-mail validation

To see what your regex actually does you can use YAPE::Regex::Explain:

use YAPE::Regex::Explain; my $r=YAPE::Regex::Explain->new(qr/^[\w @.]/); print $r->explain();
This outputs:
The regular expression: (?-imsx:^[\w @.]) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- ^ the beginning of the string ---------------------------------------------------------------------- [\w @.] any character of: word characters (a-z, A- Z, 0-9, _), ' ', '@', '.' ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
This might explain why your regex is nog doing what you hoped it would do.

For a better solution look on CPAN, for instance Email::Valid sounds promising

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://360880]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-03-29 05:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found