我想写一个可以删除“。”的正则表达式。最后(可以在 centa 或 centb 内)标记并将其放在前面
String input1 = "this is a   <centa> test.</centa>"
String output1 = "this is a . <centa> test</centa>"
或者
String input1b = "this is a   <centb> test.</centb>"
String output1b = "this is a . <centb> test</centb>"
或者
String input3 = "this is a   test."
String output3 = "this is a .  test"
我只能在字符串上使用 replaceAll,如何在下面的代码中创建模式?替换字符串应该是什么?
Pattern rulerPattern1 = Pattern.compile("", Pattern.MULTILINE);
System.out.println(rulerPattern1.matcher(input1).replaceAll(""));
这个边缘案例是由请求者在评论中提出的
string input4 = "“[<deleted.material>[</deleted.material>]§ 431:10A–126 [<deleted.material>]Chemotherapy services.</deleted.material>] <added.material>Cancer treatment.</added.material>test snl."
string output4 = "“[<deleted.material>[</deleted.material>]§ 431:10A–126. [<deleted.material>]Chemotherapy services.</deleted.material>] <added.material>Cancer treatment.</added.material>test snl"