c has asked for the wisdom of the Perl Monks concerning the following question:
} elsif { ( $add_destination =~ /^(\w|\.|\-)+\@(\w)+\.(\w)+(.|..)(\w) ++\@/ )
It seems poorly formed to me, but works. I am not really certain why i need the or operator within my first grouping, but trying (\w\.\-)+ doesnt seem to work even though I use a similar regex, [^\w\.\-] to test for illegal characters within an email address.
It might be easier to just check for more than one \@ but I am not sure how to say one is okay, but two is not within regex. The above regex maps out an email address followed by one or two characters including the possibility of whitespace followed by the beginning of another email address which will include another \@
I know that a couple modules like Email::Valid
could be my solution for checking for illegal characters, but I know their must be a better solution for checking for multiple \@ within a string.
humbly -c
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Checking on multiple email addresses in a string
by wog (Curate) on Jul 22, 2001 at 19:50 UTC | |
|
(dkubb) Re: (2) Checking on multiple email addresses in a string
by dkubb (Deacon) on Jul 22, 2001 at 21:58 UTC | |
|
Re: Checking on multiple email addresses in a string
by wine (Scribe) on Jul 22, 2001 at 19:45 UTC |