public static void main(String[] args) {
String a = "2019-04-26,2019-05-26,2019-06-26,2019-07-28";
String b = a.replaceAll("(2019-04)\\S{3},", "");
System.out.println("替换前:" + a);
System.out.println("替换后:" + b);
}

  

截图:

使用正则表达式 保留最近三个月的日期

 

相关文章:

  • 2022-12-23
  • 2021-09-22
  • 2021-12-11
  • 2022-12-23
  • 2021-04-27
  • 2021-06-03
猜你喜欢
  • 2021-12-27
  • 2022-01-05
  • 2021-12-27
  • 2021-12-27
  • 2021-11-19
  • 2022-02-01
相关资源
相似解决方案