日期:2014-05-20 浏览次数:20684 次
import java.util.regex.*; public class Test4{ public static void main(String[] args){ String regex="(?<=<li>)([^<>]+)(?=[;\\s])"; String str="<li>1-212; <li>2-eiewrw; </li> <li>3-7841; <li>4-93993 "; Pattern pa=Pattern.compile(regex); Matcher matcher=pa.matcher(str); while(matcher.find()){ System.out.println(matcher.group(1)); } } }