用非贪婪模式的正则表达式
就是比贪婪模式的正则表达式多了个问号
我给你个Java语言的例子,你看看吧
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class BB {
public static void main(String[] args) {
String reciveString=""; 0 成功 41961192 2 资源上传服务 4000 41961192 3 WEB站点监控 4000
String regex="[\\s\\S]*?";
Pattern p=Pattern.compile(regex);
Matcher m=p.matcher(reciveString);
while(m.find()){
System.out.println(m.group());
}
}
}
运行结果