String phrase = "An_Apple_A_Day_Keeps_The_Doctor_Away"; System.out.println(phrase.replaceAll("_", " "); // prints 'An Apple A Day Keeps The Doctor Away'