2013-03-29 40 views
8

我想从一个字符串,就像收到电子邮件:查找电子邮件中的String

"*** [email protected]&&^ [email protected]((& ";

private static Pattern p = Pattern.compile("(^[a-zA-Z0-9_.+-][email protected][a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$)"); 

上面的代码可以得到一个电子邮件。

我该如何得到所有?

+0

您可以使用模式类在java中 [见这里] [1] [1]:http://stackoverflow.com/questions/7899116/extracting-names-and -email-address-from-string-with-regex – PSR

+0

see here http://stackoverflow.com/questions/7899116/extracting-names-and-email-address-from-string-with-regex – PSR

+0

我不确定电子邮件中允许使用'+'字符。 – sp00m

回答

0

只需卸下^$锚。

相关问题