日期:2014-05-20 浏览次数:20736 次
(?<=^
------解决方案--------------------
,)\s*([^,\s]+)
import java.util.regex.*;
public class TestTmp {
public static void main(String[] args) {
String sa=" temp1,abc b1, temp2 d1,defh,ghxs gh";
//(?<=^
------解决方案--------------------
,)\s*([^,\s]+)
Pattern pattern = Pattern.compile("(?<=^
------解决方案--------------------
,)\\s*([^,\\s]+)");
Matcher matcher = pattern.matcher(sa);
int count = 0;
while (matcher.find()) {
System.out.println("第" + ++count + "项:【" + matcher.group(1) + "】");
}
}
}