protected function _replaceReferences($input, ContainerInterface $container, $default = null, $startDelimiter = '${', $endDelimiter = '}')
    {
        $regexpDelimiter = '/';
        $input           = $this->_normalizeString($input);
        $defaultValue    = $default === null ? '' : $this->_normalizeString($default);

        $startDelimiter = preg_quote($this->_normalizeString($startDelimiter), $regexpDelimiter);
        $endDelimiter   = preg_quote($this->_normalizeString($endDelimiter), $regexpDelimiter);

        $regexp = $regexpDelimiter . $startDelimiter . '(.*?)' . $endDelimiter . $regexpDelimiter;

        preg_match_all($regexp, $input, $matches);

        foreach ($matches[0] as $i => $token) {
            $key = $matches[1][$i];
            try {
                $value = $container->get($key);
            } catch (NotFoundExceptionInterface $e) {
                $value = $defaultValue;
            }
            $input = str_replace($token, $value, $input);
        }

        return $input;
    }