
正则
文章平均质量分 67
future_1024
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
正则学习——1. java中Matcher类的group用法
1.前言 最近在某网站学习时,看到讲师编写的工具类,有些疑惑,于是自己写了一个demo进行测试2.讲师的demopublic static String getFirstString(String dealStr, String regexStr, int n) { if (dealStr == null || regexStr == null || n < 1) { ret...原创 2018-06-21 23:20:12 · 4900 阅读 · 2 评论 -
正则学习——2: .* 和 .*? 的区别?
?涉及到贪婪模式当正则表达式中包含能接受重复的限定符时,通常的行为是(在使整个表达式能得到匹配的前提下)匹配尽可能多的字符。.*?为贪婪匹配,表示匹配尽量多的任意字符。.*为懒惰匹配,表示匹配尽量少的任意字符。例:public static void main(String[] args) { String regex1 = "a.*?t"; String regex2 = "a.*t";...原创 2018-07-01 10:54:43 · 1608 阅读 · 0 评论