public static String replaceAll(String str, Pattern regex, Replacer replacer){
		if(regex==null){
			throw new ESTypeException("A regex must be provided");
		}
		if(replacer==null){
			throw new ESTypeException("A replacer must be provided");
		}
		Matcher matcher=regex.matcher(str);
		StringBuffer sb = new StringBuffer();
		while (matcher.find()) {
			matcher.appendReplacement(sb, replacer.next(matcher,matcher.start(),str));
		}
		matcher.appendTail(sb);
		return sb.toString();
	}