Quantcast
Channel: BlogJava--随笔分类-java
Viewing all articles
Browse latest Browse all 31

正则表达式笔记

$
0
0
String regex = "<a.*?/a>";//取链接
        Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
        Matcher mt = pattern.matcher(str);
        while (mt.find()) {
        String s=mt.group();
        }
        String regex2 = ">.*?</a>";// 标题部分
        String regex3 = "imgs/[([0-9])]+.(jpg|gif|png|bmp)";//取图片

输入例子可产生正则表达式
http://sourceforge.net/projects/quickrex/

在线测试
http://www.fileformat.info/tool/regex.htm



leekiang 2010-04-21 12:30 发表评论

Viewing all articles
Browse latest Browse all 31

Trending Articles