2
如何使用perl从字符串中提取电子邮件地址并将电子邮件地址放入变量中? 我的琴弦的样子如何使用perl从字符串中提取电子邮件地址?
Ben Tailor <[email protected]>
[email protected], [email protected], Ben Tailor <[email protected]>
我tryed这
$string ="Ben Tailor <[email protected]>";
$string =~ /\b([^\s][email protected][^\s]+)\b/g ;
print $string;
和OUT把XAS:
Ben Tailor <[email protected]>
有人有一个想法?
使用
Email::Valid->address($string);
THX
它会输出相同的输入字符串,因为你所做的只是对它执行正则表达式匹配,然后再次输出字符串。您没有使用捕获部分$ 1或替换s /// g; – dalton 2010-07-18 16:44:59