码迷,mamicode.com
首页 > 其他好文 > 详细

提取某个符合条件的字符串中的中文字符 例子

时间:2015-09-06 16:26:26      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:



public class TestRegex {
    public static void main(String[] args) {
        String str = "BookName: \"我欲封天\",CategoryName: \"仙侠\", SubCategoryName: \"古典仙侠\"";

        Pattern p = Pattern.compile("(?i)(?<=CategoryName\\: \")([\u4e00-\u9fa5]+)");
        Matcher matcher = p.matcher(str);
        while (matcher.find()) {
            System.out.println(matcher.group());
        }
    }
}

提取某个符合条件的字符串中的中文字符 例子

标签:

原文地址:http://my.oschina.net/u/2329222/blog/501775

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!