m1.groupCount()返回 捕获 组的数量,即 第一种情况为1,因此您不会进入此循环
for(int i = 1;i<m1.groupCount(); i++)
它应该是
for(int i = 1; i<=m1.groupCount(); i++)

m1.groupCount()返回 捕获 组的数量,即 第一种情况为1,因此您不会进入此循环
for(int i = 1;i<m1.groupCount(); i++)
它应该是
for(int i = 1; i<=m1.groupCount(); i++)