初始字符串是
System.out.println(myString)
看起来像这样
Name: Sacha
Last name: Sidor
.............
Name: Masha
........
我试图捕捉第二个名字,即玛莎
Pattern pattern = Pattern.compile("(?:Name:.*?){2}\\n");
Matcher matcher = pattern.matcher(myString);
String secondName = "";
while (matcher.find()) {
secondName = matcher.group();
}
System.out.println(secondName); // prints nothing ???