JavaSelenium在模式匹配器中使用变量

JavaSelenium在模式匹配器中使用变量,java,selenium,Java,Selenium,我需要帮助。这是我现在拥有的代码: Pattern pattern = Pattern.compile("\\d+"); Matcher matcher = pattern.matcher(dateBirth); while (matcher.find()) { System.out.println(dateBirth.substring(matcher.start(), matcher.end())); } 日期出生日期its=2011年11月3日,来自excel 此代码的结果是

我需要帮助。这是我现在拥有的代码:

Pattern pattern = Pattern.compile("\\d+");
Matcher matcher = pattern.matcher(dateBirth);
while (matcher.find()) {
    System.out.println(dateBirth.substring(matcher.start(), matcher.end()));
} 
日期出生日期its=2011年11月3日,来自excel 此代码的结果是

 3
 11
 11
我想把这3个数字,在matcher之后,分别放在它自己的变量中。 但我不知道怎么做。需要在下拉菜单中查找日期、嘴巴和年份。

最佳:

LocalDate localDate =
    // Rearrange the date pattern to whatever you need, it's not clear.
    LocalDate.parse(dateBirth, DateTimeFormatter.ofPattern("d/M/y");
int year = localDate.getYear(); // May need to add 2000, if that's what you intend.
int month = localDate.getMonthValue();
int day = localDate.getDayOfMonth();
备选方案:

String[] parts = dateBirth.split("/");
int year = Integer.parseInt(parts[0]);
int month = Integer.parseInt(parts[1]);
int day = Integer.parseInt(parts[2]);

为什么不在
/
上拆分?无法在索引0处分析错误分机“3/11/11”=(