code: public static String convertGlobToRegex(String pattern) {
      pattern = pattern.replaceAll("[\\\\\\.\\(\\)\\+\\|\\^\\$]", "\\\\$0");
      pattern = pattern.replaceAll("\\[\\\\\\^", "[^");
  
      pattern = Ruby.String.of(pattern).gsub("\\{[^\\}]+\\}", m -> {
        m = m.replaceAll(",", "|");
        m = "(" + m.substring(1, m.lastIndexOf('}')) + ")";
        return m;
      }).toS();
      pattern = pattern.replaceAll("\\?", ".{1}");
      pattern = pattern.replaceAll("\\*\\*/", "(.+/)?");
      pattern = pattern.replaceAll("\\*", "[^/]*");
      return pattern;
    }
docs: Converts a glob pattern to Regex string.
  
  @param pattern
  a glob pattern
  @return a Regex string