java 正则表达式匹配字符串

private static List<String> getImage(String str){
        List<String> tmp=new ArrayList<String>();
        String regex="<img src=\"([^\"]+?)\" />";
        Pattern pattern = Pattern.compile(regex);  
        Matcher matcher = pattern.matcher(str); 
        System.out.println(str);
        while(matcher.find()){
        
            tmp.add(matcher.group(1).toString());
            
        }
        return tmp;       
    }

 

posted @ 2015-10-29 21:17  丶下雨了  阅读(3275)  评论(0编辑  收藏  举报