public function resolveUrl($url, &$parameters)
        {
            $parameters = array();

            $patternSegments = $this->segments;
            $patternSegmentNum = count($patternSegments);
            $urlSegments = Helper::segmentizeUrl($url);

            /*
             * If the number of URL segments is more than the number of pattern segments - return false
             */
            if (count($urlSegments) > count($patternSegments)) return false;

            /*
             * Compare pattern and URL segments
             */
            foreach ($patternSegments as $index => $patternSegment) {
                $patternSegmentLower = mb_strtolower($patternSegment);

                if (strpos($patternSegment, ':') !== 0) {
                    /*
                     * Static segment
                     */
                    if (!array_key_exists($index, $urlSegments) || $patternSegmentLower != mb_strtolower($urlSegments[$index]))
                        return false;
                } else {
                    /*
                     * Dynamic segment. Initialize the parameter
                     */
                    $paramName = Helper::getParameterName($patternSegment);
                    $parameters[$paramName] = false;

                    /*
                     * Determine whether it is optional
                     */
                    $optional = Helper::segmentIsOptional($patternSegment);

                    /*
                     * Check if the optional segment has no required segments following it
                     */
                    if ($optional && $index < $patternSegmentNum - 1) {
                        for ($i = $index + 1; $i < $patternSegmentNum; $i++) {
                            if (!Helper::segmentIsOptional($patternSegments[$i])) {
                                $optional = false;

                                break;
                            }
                        }
                    }

                    /*
                     * If the segment is optional and there is no corresponding value in the URL, assign the default value (if provided)
                     * and skip to the next segment.
                     */
                    $urlSegmentExists = array_key_exists($index, $urlSegments);

                    if ($optional && !$urlSegmentExists) {
                        $parameters[$paramName] = Helper::getSegmentDefaultValue($patternSegment);

                        continue;
                    }

                    /*
                     * If the segment is not optional and there is no corresponding value in the URL, return false
                     */
                    if (!$optional && !$urlSegmentExists) return false;

                    /*
                     * Validate the value with the regular expression
                     */
                    $regexp = Helper::getSegmentRegExp($patternSegment);

                    if ($regexp) {
                        try {
                            if (!preg_match($regexp, $urlSegments[$index])) return false;
                        } catch (\Exception $ex) {}
                    }

                    /*
                     * Set the parameter value
                     */
                    $parameters[$paramName] = $urlSegments[$index];
                }
            }

            return true;
        }