Pattern p = Pattern.compile("cat");Matcher m = p.matcher("one cat two cats in the yard");StringBuffer sb = new StringBuffer();while (m.find()) { m.appendReplacement(sb, "dog");}m.appendTail(sb);System.out.println(sb.toSt
StringBuilder sb=new StringBuilder(); sb.AppendLine("The world is fair and wonderful.Everything depend on myself"); sb.AppendLine("Stay focused and keep shipping"); sb.AppendLine("Devote myself into the present job"); sb.Appe