String phrase = "StEVen"; String result = phrase.replaceAll("(?i)e", "f"); System.out.println(result);