日期:2014-05-20  浏览次数:20773 次

正则表达式过滤问题。、。。求指教~~~急急急~~~
aaaaa<img src="http://ctffamily.com/images/f/12.gif" width="24" height="24">nnnnnnnn<img src="http://ctffamily.com/images/f/6.gif" width="24" height="24">bbbbbbbbbbbbbbbbbb

如何过滤成aaaaa12nnnnnnn6bbbbbbbbbbb---------12、6、均为文件名

------解决方案--------------------
Java code

public static void main(String[] args) {
        String str = "aaaaa<img src=\"http://ctffamily.com/images/f/12.gif\" width=\"24\" " +
                "height=\"24\">nnnnnnnn<img src=\"http://ctffamily.com/images/f/6.gif\" " +
                "width=\"24\" height=\"24\">bbbbbbbbbbbbbbbbbb";
        str = str.replaceAll("<img.*?src=.*?/([^/]*?)\\.gif.*?>", "$1");
        System.out.println(str);
    }