String regEx = "([\s\S]*?)";String s = "123456789";Pattern pat = Pattern.compile(regEx);Matcher mat = pat.matcher(s);boolean rs = mat.find();for(int i=1;i<=mat.groupCount();i++){ System.out.println(mat.group(i));}