in reply to Checking on multiple email addresses in a string
That said, character classes are always inclosed by []s. (\w\.\-)+ tries to match a word character followed by a dot followed by a - one or more times. You can fix this problem by using a real character class: [\w.-]+ (note that in character classes the . is not special, and the - is not special at the end or beginning of the character class.)
You can check for more then one @ with tr: my $count = $addy =~ tr/@//; if ($count > 1) { ... } You could also try a regex like /@[^@]*@/ to check for that.
update: tr/+/*/ in last regex.
update: fixed first sentence (to mention multiple e-mails.)
|
|---|