- public class Demo {
- public static void main(String[] args) {
- String str = "sdqqfgkkkhjppppkl";
- String regex = "(.)\\1";//(.) \\1这句怎么理解?
- // String regex = "(.)\\1+";//这句为什么会改变输出结果
- String[] strArray = str.split(regex);
- for (String s : strArray) {
- System.out.println(s);
- }
- }
- }
复制代码
|