代码 :
import java.util.regex.*;
public class eq {
public static void main(String []args) {
String str1 = "some=String&Here&modelId=324";
Pattern rex = Pattern.compile(".*modelId=([0-9]+).*");
Matcher m = rex.matcher(str1);
System.out.println("id = " + m.group(1));
}
}
错误 :
Exception in thread "main" java.lang.IllegalStateException: No match found
我在这里做错了什么?