可能重复:
How to extract email address from a string using perl?
说我有这样的字符串:
博士。 X学校名称在无处pete@school.edu Blah blah 3 one niner
如何从那里收到电子邮件?
答案 0 :(得分:5)
您可以尝试Email::Find。
#!/usr/bin/perl
use strict; use warnings;
use YAML;
use Email::Find;
my $finder = Email::Find->new(\&print_email);
while ( my $data = <DATA> ) {
$finder->find(\$data);
}
sub print_email {
print Dump \@_;
}
__DATA__
Say I have a string like this:
Dr. X University of School name in nowhere pete@school.edu Blah blah 3 one niner
How would I get the email out of there?
输出:
--- - !!perl/array:Mail::Address - '' - pete@school.edu - pete@school.edu
答案 1 :(得分:-2)
您没有说这种语言,但您可以使用此方法:
http://www.codeproject.com/KB/vb/extractemail.aspx http://www.webdeveloper.com/forum/showthread.php?t=200875
Google上有很多其他人(没有冒犯,只是我看到的帮助你。)