Java bug?2个identic正则表达式的不同输出

0 java regex

我的正则表达式有两个来自相同代码的不同输出......但我不知道什么是错的.这是一段代码,希望你能帮助我.谢谢!

String s = "48° 18? 13,94? nördliche Breite, "
         + "11° 34? 31,98? östliche Länge";

String kommazahl = "[0-9]{1,2}([\\.,][0-9]+)?";
String zahl = "[0-9]{1,2}";

Pattern p1 = Pattern.compile("("+ zahl +"[°/| ]{1,2}"+ zahl +"(['?/| ]{1,2}("+ kommazahl +")?)?).*"
                            +"("+ zahl +"[°/| ]{1,2}"+ zahl +"(['?/| ]{1,2}("+ kommazahl +")?)?).*");

Matcher m1 = p1.matcher(s);

System.out.println(m1.group(1) + "\n" + m1.group(5));

// Output should be:
// 48° 18? 13,94
// 11° 34? 31,98

// Output is:
// 48° 18? 13,94
// 1° 34? 31,98
Run Code Online (Sandbox Code Playgroud)

laa*_*lto 5

.*贪婪地匹配11个中的前1个,同时仍然允许模式的其余部分匹配.替换.*为类似的东西[^0-9]*.