private function param($key, $string, $value) {

        $field_required = false;

        // If the field name ends with a '*', the parameter is considered as required
        if (preg_match('/^(.+)\*$/', $key, $bits)) {

            $key = $bits[1];
            $field_required = true;

        }

        // The $value query object contains all regex which will be used by the collector to parse the route fields
        $value->setQuery($key, $string, $field_required);

        /* Every parameter can include it's own logic into the regular expression,
         * it can use backreferences and it's expected to be used against a single parameter.
         * This means that it can't be used as is to build the route regular expression,
         * Backreferences are not useful at this point and can make the regular expression more time consuming
         * and resource hungry. This is why they are replaced with the grouping parenthesis.
         * Eg: (value) changes in (?:value)
         *
         * Delimiting characters like '^' and '$' are also meaningless in the complete regular expression and
         * need to be removed. Contrariwise, wildcards must be delimited in order to keep the whole regular
         * expression consistent, hence a '?' is added to all the '.*' or '.+' that don't already have one.
         */
        $string = preg_replace("/(?<!\\\\)\\((?!\\?)/", '(?:', $string);
        $string = preg_replace("/\\.([\\*\\+])(?!\\?)/", '.${1}?', $string);
        $string = preg_replace("/^[\\^]/", '', $string);
        $string = preg_replace("/[\\$]$/", '', $string);

        /* The produced regular expression is grouped and associated with its key (this means that the 'preg_match'
         * function will generate an associative array where the key/value association is preserved).
         * If the field is required, the regular expression is completed with a '{1}' (which make it compulsory),
         * otherwise a '?' is added.
         */
        return '(?P<'.$key.'>'.$string.')'.(($field_required) ? '{1}' : '?');

    }