The reason your current regex won't work is that the astrix is greedy, i.e. it grabs everything it can. Since it is allowed to match anything, it grabs everything except the last bit of whitespace (which is required for the regex to match at all).
More of an overall issue is that matching an e-mail address is quite a bit harder than most people think. See Email::Valid, which contains the generally accepted regex for matching e-mail addresses (it's several thousand characters long, and it doesn't even match emebedded comments, as allowed by RFC 822).
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
: () { :|:& };:
Note: All code is untested, unless otherwise stated
In reply to Re: RegEx for email help
by hardburn
in thread RegEx for email help
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |