private void saveConditionalURIs(String hash, MultiValueMap<String, String> params) {

    logger.info("Iterating through conditional params (if there are)");

    String ifurl = "ifurl";
    String expr = "expr";

    int paramn = 1;

    String firstparam = ifurl + paramn;
    String secondparam = expr + paramn;

    while ((params.getFirst(firstparam) != null && params.getFirst(secondparam) != null)
        && (!params.getFirst(firstparam).equals("") && !params.getFirst(secondparam).equals(""))) {
      logger.info(
          "Seeking url&expression -- "
              + firstparam
              + params.getFirst(firstparam)
              + secondparam
              + params.getFirst(secondparam));
      MultiplesURIs mu =
          new MultiplesURIs(hash, params.getFirst(firstparam), params.getFirst(secondparam));
      multiplesURIsRepository.save(mu);

      paramn++;
      firstparam = ifurl + paramn;
      secondparam = expr + paramn;
    }

    logger.info("Already cicled around " + paramn + " conditional params");
  }
  private String exprMatching(String hash, HttpServletRequest request, String target) {
    List<MultiplesURIs> listmu = multiplesURIsRepository.listConditionals(hash);
    if (listmu != null) {
      logger.info("In expr Matching");

      for (int i = 0; i < listmu.size(); i++) {
        Pattern exprReg = Pattern.compile(listmu.get(i).getExpression()); // "(.*)max:([0-9]*)"
        String value = request.getHeader("user-agent");
        Matcher m = exprReg.matcher(value);
        if (m.matches()) {
          logger.info("MATCH FOUND!!" + value + " - " + listmu.get(i).getExpression());
          return listmu.get(i).getTarget();
        }
      }
      logger.info("match NOT found");
      if (target.equals("")) {
        throw new ResourceNotFoundException();
      }
    }
    logger.info("This URI doesnt match any Conditional URIs");
    return null;
  }