MDA/MDD/TDD/DDD/DDDDDDD
posts - 536, comments - 111, trackbacks - 0, articles - 0
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

正则表达式笔记

Posted on 2010-04-21 12:30 leekiang 阅读(257) 评论(0)  编辑  收藏 所属分类: java文件处理
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


只有注册用户登录后才能发表评论。


网站导航: