これらの要件を満たす正規表現を作成するにはどうすればよいですか? string.replaceAll 関数しか使用できません..
a)”
段落の最後に表示されるもので“
、 を含むが含まないもの —“ “
削除”
b)“
段落の先頭に表示されているものを削除 “
[注: がある場合は“ “
、現在は である必要があります“
]
c)段落の先頭に”
一致せずに段落の末尾に表示されるもの–削除“
”
編集:
Rule a)
Transform:
String input1 ="“remove quotes”"
String output1 ="“remove quotes"
Don't change anything:
String input1 ="““remove quotes”"
String output1 ="““remove quotes”"
Rule b)
Transform:
String input1 ="“remove quotes”"
String output1 ="remove quotes”"
Replace with single ldquo:
String input1 ="““remove quotes”"
String output1 ="“remove quotes”"
Rule c)
Do nothing (there is a matching ldquo):
String input1 ="“do not remove quotes”"
String output1 ="“do not remove quotes”"
Transform(no matching ldquo hence remove rdquo):
String input1 ="remove quotes”"
String output1 ="remove quotes"
I think I am going to run all the 3 rules separately on the string. What would be 3 regexes and replace expressions ?