(String).replaceAll [1]
public String replaceAll(String regex, String replacement)

正規表現を指定して文字列を置換します。

String s1 = "Java and Python.";
System.out.println(s1.replaceAll("[pP]yt", "hoge"));