「。」を削除できる正規表現を書きたい。最後に (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"