Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static String getFileNameByUrl(String url) { // TODO Auto-generated method stub Pattern p = Pattern.compile("\\w+"); Matcher m = p.matcher(url); String filename = ""; while (m.find()) { String str = m.group(); filename = str; } return filename; } }