Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: regexp to only allow for formally valid email addresses

by hangon (Deacon)
on Mar 07, 2007 at 20:16 UTC ( [id://603709]=note: print w/replies, xml ) Need Help??


in reply to Re^2: regexp to only allow for formally valid email addresses
in thread regexp to only allow for formally valid email addresses

Unless you don't think the character classes are a bit redundant. I assume fraktalisman only wants to match \w as well as '-' and '.' since its for e-mail addresses.

# my guess is that he's not trying to do this =~ /^[.]+@[.]+$/ # either of these make more sense for matching an e-mail address =~ /^[a-zA-Z_\-\.0-9]+@[a-zA-Z_\-\.0-9]+$/ =~ /^[\w\-\.]+@[\w\-\.]+$/

Or am I missing something painfully obvious?

Replies are listed 'Best First'.
Re^4: regexp to only allow for formally valid email addresses
by Thelonius (Priest) on Mar 07, 2007 at 20:54 UTC
    The dot is not special within square brackets. /[.]/ only matches ".", not "a".

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-06-13 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.