private String checkUrl(String url){
        url = url.trim();
        String extensionRegex = "(\\.jpg|\\.jpeg|\\.png|\\.gif|\\.JPG|\\.PNG|\\.JPEG|\\.GIF)";
        Pattern pattern = Pattern.compile(extensionRegex,Pattern.MULTILINE);
        Matcher matcher = pattern.matcher(url);

        if(matcher.find()) {

            String extension = matcher.group(1);
            System.out.println("extension:"+extension);
            int st = url.lastIndexOf(extension);
            System.out.println(url.lastIndexOf(extension));
            System.out.println(st);
            url = url.substring(0,st)+extension;
            System.out.println(url);
        }

        int st = url.lastIndexOf("!");
        if(st>0){
            url = url.substring(0,st);
        }
        st = url.lastIndexOf("?");
        if(st>0){
            url = url.substring(0,st);
        }
        String chinaWordRegex = "([\\u4e00-\\u9fa5])";
        Pattern chinaWordPattern = Pattern.compile(chinaWordRegex,Pattern.MULTILINE);
        Matcher chinaWordMatcher = chinaWordPattern.matcher(url);
        while(chinaWordMatcher.find()){
            String chinaWord = chinaWordMatcher.group(1);

            try {
                String encodeWord = URLEncoder.encode(chinaWord, "UTF-8");
                url = url.replaceAll(chinaWord,encodeWord);
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }

        }
        return url;
    }