日期:2014-05-20 浏览次数:20709 次
regex = "\\w{20}" String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567"; Matcher matcher =Pattern.compile(regex).matcher(str); while(matcher.find()) System.out.println(Arrays.toString( matcher.group().toCharArray() )); /* [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t] [u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N] [O, P, Q, R, S, T, U, V, W, X, Y, Z, 0, 1, 2, 3, 4, 5, 6, 7] */