public String replaceStringAll(String source, String regex, String replacement) {
if(source == null || regex == null || replacement == null){
return null;
}
regex = regex.replaceAll("\\.", "\\\\.");
regex = regex.replaceAll("\\*", "\\\\*");
regex = regex.replaceAll("\\?", "\\\\?");
regex = regex.replaceAll("\\+", "\\\\+");
regex = regex.replaceAll("\\[", "\\\\[");
regex = regex.replaceAll("\\{", "\\\\{");
regex = regex.replaceAll("\\(", "\\\\(");
regex = regex.replaceAll("\\)", "\\\\)");
regex = regex.replaceAll("\\^", "\\\\^");
regex = regex.replaceAll("\\|", "\\\\|");
regex = regex.replaceAll("\\$", "\\\\\\$");
return source.replaceAll(regex, replacement);
}