Don't ask to ask, just ask | |
PerlMonks |
Re: @ in regex, or not?by Clownburner (Monk) |
on Mar 26, 2001 at 21:57 UTC ( [id://67264]=note: print w/replies, xml ) | Need Help?? |
This is a lot harder than it looks, if you have to pass every possible RFC-valid Email address. The Mastering Regular Expressions book has the most complete example I know of, but it's a little over 5k in size. One thing to consider here is what your target audience is likely to enter as an email address, and think about how precise to need to be. If it's an intranet application and everyone's email addresses are in a simple format (foo@barr.com) then a simple Regexp is likely the trick, but if you may need to support international and unusual (UUCP gateway, anyone?) email addresses, you might go to something more elaborate, like the MRE method. You can download the email regexp here: http://public.yahoo.com/~jfriedl/regex/code.html HTH! Signature void where prohibited by law.
In Section
Seekers of Perl Wisdom
|
|