@@ -0,0 +1,1396 @@
+/**%0A *Copyright 2012-2013.All Rights Reserved%0A */%0Apackage org.pretty.common.utils;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.concurrent.ConcurrentHashMap;%0Aimport java.util.regex.Matcher;%0Aimport java.util.regex.Pattern;%0A%0A/**%0A * Html %E6%93%8D%E4%BD%9C%E7%9B%B8%E5%85%B3%E7%9A%84%E5%B7%A5%E5%85%B7%0A * @author %3Ca href=%22mailto:lazy_p@163.com%22%3Elazyp%3C/a%3E%0A * @version 2013-10-15%0A */%0Apublic final class HtmlUtils %7B%0A    private static Map%3CString, Pattern%3E patternCacheMap = new ConcurrentHashMap%3CString, Pattern%3E();%0A%0A    /**%0A     * %E6%8F%90%E5%8F%96html%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84image url%E5%9C%B0%E5%9D%80%0A     * @param html%0A     * @return%0A     */%0A    public static List%3CString%3E extractImgSrc(String html) %7B%0A        Pattern extractImgSrcPattern = patternCacheMap.get(%22extractImgSrcPattern%22);%0A        if (extractImgSrcPattern == null) %7B%0A            extractImgSrcPattern = Pattern.compile(%22%3Cimg%5B%5E%3E%5D*src=%5C%22(%5B%5E%5C%22%5D+)%5C%22%5B%5E%3E%5D*%3E%22);%0A            patternCacheMap.put(%22extractImgSrcPattern%22, extractImgSrcPattern);%0A        %7D%0A%0A        List%3CString%3E imgSrcList = new ArrayList%3CString%3E();%0A        Matcher m = extractImgSrcPattern.matcher(html);%0A        while (m.find()) %7B%0A            imgSrcList.add(m.group(1));%0A        %7D%0A        return imgSrcList;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        String txt = %22asadsadsad%3Cimg src=%5C%22xxxx.jpg%5C%22 alt=%5C%22%5C%22/%3Edasdsadadsa%5Cn%5Cr%3Cimg src=%5C%22xda.gif%5C%22 alt=%5C%22x%5C%22 %3E%22;%0A        System.out.println(HtmlUtils.extractImgSrc(txt));%0A    %7D%0A%7D%0A

添加HtmlUtils.java html tag处理相关工具