日期:2014-05-19 浏览次数:20866 次
String[] arr = {"I.[21231853:680492]smpp_TAQ:_13189867588_1_aaaaaaaa_J2012052123360846583", "I.[21231853:861244]smpp_TUQ:_JFK20120521510548945_13249852861_1_aaaaaaaa_3000_0_N_2012-05-21 23:36:08_511201167443476"}; for (String s : arr) { //替换后分割,sa[0],sa[1]就是LZ所需要的 String[] sa = s.replaceAll(".*?\\[(\\d+:\\d+)\\].*?(J[A-Z]*\\d+).*", "$1,$2").split(","); System.out.printf("first=%s, second=%s\n", sa[0], sa[1]); }