我有一个字符串"abcde-abc-db-tada_x12.12_999ZZZ_121121.333"
我想要的结果是999ZZZ
我尝试使用了以下方法:
private static String getValue(String myString) {
Pattern p = Pattern.compile("_(\\d+)_1");
Matcher m = p.matcher(myString);
if (m.matches()) {
System.out.println(m.group(1)); // Should print 999ZZZ
}
else {
System.out.println("not found");
}
}