public class crazy {
public static void main(String[] args) {
List list = new ArrayList();
String str = "(.)*([0-9])+(.)*";
Scanner sc = new Scanner(System.in);
System.out.println("请输入字符串,当输入\"quit\"时,结束:");
while(true){
String ss = sc.nextLine();
if (ss.equals("quit")) {
break;
}
list.add(ss);
}
System.out.println(list);
List list2 = new ArrayList();
for (int i = 0; i <list.size(); i++) {
if(((String)list.get(i)).matches(str)) {
list2.add(list.get(i));
}
}
System.out.println(list2);