public static Map<String, Set<String>> getVarListInString(String input) {
    Map<String, Set<String>> varMap = new HashMap<>();
    Matcher matcher = VAR_PATTERN_IN_DEST.matcher(input);
    while (matcher.find()) {
      // $var or ${var}
      String varName = matcher.group(0);
      // var or {var}
      String strippedVarName = matcher.group(1);
      if (strippedVarName.startsWith("{")) {
        // {varName} = > varName
        strippedVarName =
            strippedVarName.substring(1, strippedVarName.length() - 1);
      }
      varMap.putIfAbsent(strippedVarName, new HashSet<>());
      varMap.get(strippedVarName).add(varName);
    }
    return varMap;
  }
@Test
  public void testGetVarListInString() throws IOException {
    String srcRegex = "/(\\w+)";
    String target = "/$0/${1}/$1/${2}/${2}";
    RegexMountPoint regexMountPoint =
        new RegexMountPoint(inodeTree, srcRegex, target, null);
    regexMountPoint.initialize();
    Map<String, Set<String>> varMap = regexMountPoint.getVarInDestPathMap();
    Assert.assertEquals(varMap.size(), 3);
    Assert.assertEquals(varMap.get("0").size(), 1);
    Assert.assertTrue(varMap.get("0").contains("$0"));
    Assert.assertEquals(varMap.get("1").size(), 2);
    Assert.assertTrue(varMap.get("1").contains("${1}"));
    Assert.assertTrue(varMap.get("1").contains("$1"));
    Assert.assertEquals(varMap.get("2").size(), 1);
    Assert.assertTrue(varMap.get("2").contains("${2}"));
  }