YuFeng

java 正则(非贪婪模式)
String count = "我是开始******数据部分******我是结束...
扫描右侧二维码阅读全文
25
2018/06

java 正则(非贪婪模式)

            String count = "我是开始******数据部分******我是结束";
            String regex = "我是开始(.*?)我是结束;              //(.*?)是非贪婪模式正则
            Pattern p = Pattern.compile(regex);
            Matcher m = p.matcher(count);
            if(m.find()) {
                System.out.println(m.group(1));
                }

Last modification:June 25th, 2018 at 01:03 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment