又一个正则问题
D:\文件夹\122.139.57.172\2012-05-23\yhetgame.com.txt.all\yhetgame.com
D:\文件夹\122.139.57.172\2012-05-23\yhetgame.com.txt.not200\yhetgame.com
D:\文件夹\122.139.57.172\2012-05-23\yigoupai.com.txt.all\yigoupai.com
D:\文件夹\122.139.57.172\2012-05-23\yigoupai.com.txt.not200\yigoupai.com
匹配出后面的域名~
------解决方案--------------------
Java code
public static void main(String[] args) {
String url = "D:\\文件夹\\122.139.57.172\\2012-05-23\\yhetgame.com.txt.all\\yhetgame.com.cn.info.net";
Matcher m = Pattern.compile("\\\\([^\\\\]+)$").matcher(url);
while(m.find()){
System.out.println(m.group(1));
}
}