protected function getExtensionsRegex()
    {
        $regex = '';
        $last = count($this->extensions) - 1;
        foreach ($this->extensions as $index => $ext) {
            $regex .= '\.'.$ext.'$';
            $regex .= $index !== $last ? '|' : '';
        }

        return '('.$regex.')';
    }