Remove a random expression from string

后端 未结 7 1658
春和景丽
春和景丽 2021-01-21 06:25

I have a string/column something like this

String a = \"000003023_AggregateStopLossLimit_W x3A 973911_2012-12-22.PDF\";

I want to create a subs

7条回答
  •  花落未央
    2021-01-21 07:00

    final String r = a.replaceAll(" .*?(?=_)", "");
    

    if you print the r, it gave output:

    000003023_AggregateStopLossLimit_W_2012-12-22.PDF
    

提交回复
热议问题