explain this function and why should i use it 
  private def cleanRegex(validChars: String): String = {
    validChars
      .replaceAll("\\\\", "\\\\\\\\")
      .replaceAll("\\/", "\\\\/")
      .replaceAll("\\.", "\\\\.")
      .replaceAll("\\?", "\\\\?")
      .replaceAll("\\[", "\\\\[")
      .replaceAll("\\]", "\\\\]")
      .replaceAll("\\{", "\\\\{")
      .replaceAll("\\}", "\\\\{")
      .replaceAll("\\(", "\\\\(")
      .replaceAll("\\)", "\\\\)")
      .replaceAll("\\-", "\\\\-")
      .replaceAll("\\^", "\\\\^")
      .replaceAll("\\$", "\\\\$")
      .replaceAll("\\|", "\\\\|")
      .replaceAll("\\*", "\\\\*")
      .replaceAll("\\+", "\\\\+")
      .replaceAll("\\!", "\\\\!")
      .replaceAll("\\#", "\\\\#")
      .replaceAll("\\>", "\\\\>")
      .replaceAll("\\<", "\\\\<")
      .replaceAll("\\=", "\\\\=")
      .replaceAll("\\:", "\\\\:")
  }