私は長い紐を持っています。すべての一致を一致する正規表現 (グループ) の一部に置き換えたい。
例えば:
String = "This is a great day, is it not? If there is something, THIS IS it. <b>is</b>".
すべての単語を に置き換えたいとし"is"
ましょう"<h1>is</h1>"
。ケースはオリジナルと同じままである必要があります。したがって、私が望む最終的な文字列は次のとおりです。
This <h1>is</h1> a great day, <h1>is</h1> it not? If there <h1>is</h1> something,
THIS <h1>IS</h1> it. <b><h1>is</h1></b>.
私が試していた正規表現:
Pattern pattern = Pattern.compile("[.>, ](is)[.<, ]", Pattern.CASE_INSENSITIVE);