code: private String getRegex(String urlPattern) {
          StringBuffer buffer = new StringBuffer();
  
          Matcher matcher = PATTERN_FOR_VARIABLE_PARTS_OF_ROUTE.matcher(urlPattern);
          int pathParameterIndex = 0;
          while (matcher.find()) {
              // By convention group 3 is the regex if provided by the user.
              // If it is not provided by the user the group 3 is null.
              String namedVariablePartOfRoute = matcher.group(3);
              String namedVariablePartOfORouteReplacedWithRegex;
  
              if (namedVariablePartOfRoute != null) {
                  // we convert that into a regex matcher group itself
                  String variableRegex = replacePosixClasses(namedVariablePartOfRoute);
                  namedVariablePartOfORouteReplacedWithRegex = String.format("(?<%s>%s)",
                      getPathParameterRegexGroupName(pathParameterIndex), Matcher.quoteReplacement(variableRegex));
              } else {
                  // we convert that into the default namedVariablePartOfRoute regex group
                  namedVariablePartOfORouteReplacedWithRegex = String.format(VARIABLE_ROUTES_DEFAULT_REGEX,
                      getPathParameterRegexGroupName(pathParameterIndex));
              }
              // we replace the current namedVariablePartOfRoute group
              matcher.appendReplacement(buffer, namedVariablePartOfORouteReplacedWithRegex);
              pathParameterIndex++;
          }
  
          // .. and we append the tail to complete the stringBuffer
          matcher.appendTail(buffer);
  
          return buffer.toString();
      }
docs: Transforms an url pattern like "/{name}/id/*" into a regex like "/([^/]*)/id/*."
  <p/>
  Also handles regular expressions if defined inside routes:
  For instance "/users/{username: [a-zA-Z][a-zA-Z_0-9]}" becomes
  "/users/([a-zA-Z][a-zA-Z_0-9])"
  
  @return The converted regex with default matching regex - or the regex
  specified by the user.