String s="(Jack)jack1@163.com,"+
"(杰克)jack2@qq.com,"+
"(jack son.杰克)jack3@qq.com,"+
"(杰克.jack)jack4@qq.com,";
String result= s.replaceAll('正则表达式','');
// result = "jack1@163.com,jack2@qq.com,jack3@qq.com,jack4@qq.com
求一个正则表达式去掉邮件地址前面的姓名信息()内的,这些信息是任意的字符串,有可能是中文,英文,中英文混合,空白符等;
先谢谢了
问题补充:
String s="(Jack)jack1@163.com,"+
????????? "(杰克)jack2@qq.com,"+
????????? "(jack son.杰克)jack3@qq.com,"+
????????? "(杰克(先生).jack)jack4@qq.com,";
String result= s.replaceAll('正则表达式','');
// result = "jack1@163.com,jack2@qq.com,jack3@qq.com,jack4@qq.com
求一个正则表达式去掉邮件地址前面的姓名信息()内的,这些信息是任意的字符串,有可能是中文,英文,中英文混合,空白符等;
先谢谢了
谢谢二楼的热情解答,你的回答已经解决了我的问题,但如果邮件地址前面()里的姓名信息也有括号如:(杰克(先生).jack)jack4@qq.com,这个正则又该怎么也写呢?
问题补充:
String s="(Jack)jack1@163.com,"+
????????? "(杰克)jack2@qq.com,"+
????????? "(jack son.杰克)jack3@qq.com,"+
????????? "(杰克.jack)jack4@qq.com,";
String result= s.replaceAll('正则表达式','');
// result = "jack1@163.com,jack2@qq.com,jack3@qq.com,jack4@qq.com
谢谢二楼的热情解答,你的回答已经解决了我的问题,但如果邮件地址前面()里的姓名信息也有括号如:(杰克(先生).jack)jack4@qq.com,这个正则又该怎么也写呢?
问题补充:
String s="(Jack)jack1@163.com,"+
"(杰克)jack2@qq.com,"+
"(jack son.杰克)jack3@qq.com,"+
"(杰克(先生).jack)jack4@qq.com,"+
"()jack4@qq.com,";
这个是最全的情况了..
s.replaceAll("\([^)]+\)","");
可以解决前面三个,后面两个还是不对.