code: protected static String createRegex(String endpoint, boolean meta) {
          StringBuilder regex = new StringBuilder();
  
          regex.append('^');
  
          for (int i=0; i < endpoint.length(); i++) {
              char ch=endpoint.charAt(i);
              if ("*".indexOf(ch) != -1) {
                  regex.append('.');
              } else if ("\\.^$|?+[]{}()".indexOf(ch) != -1) {
                  regex.append('\\');
              }
              regex.append(ch);
          }
  
          regex.append('$');
  
          return regex.toString();
      }
docs: This method derives the regular expression from the supplied
  URI.
  
  @param endpoint The endpoint
  @param meta Whether this is a meta endpoint
  @return The regular expression