// replace the text between two tags with *s.System.out.println("12345".replaceAll("(?)12345", "*****"));