public Text evaluate(Text s, Text search, Text replacement) {
    if (s == null || search == null || replacement == null) {
      return null;
    }
    String r = s.toString().replace(search.toString(), replacement.toString());
    result.set(r);
    return result;
  }
UDFReplace replaces all substrings that are matched with a replacement substring.
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFReplace.java