protected function parseOperatingsystem($userAgent)
    {
        $result = array(
            'family' => 'Other',
            'major'  => null,
            'minor'  => null,
            'patch'  => null,
        );

        if (!isset($this->regexes['operating_system_parsers'])) {
            return $result;
        }

        foreach ($this->regexes['operating_system_parsers'] as $expression) {
            if (preg_match('/'.str_replace('/','\/',str_replace('\/','/', $expression['regex'])).'/i', $userAgent, $matches)) {
                if (!isset($matches[1])) { $matches[1] = 'Other'; }
                if (!isset($matches[2])) { $matches[2] = null; }
                if (!isset($matches[3])) { $matches[3] = null; }
                if (!isset($matches[4])) { $matches[4] = null; }

                $result['family'] = isset($expression['family_replacement']) ? str_replace('$1', $matches[1], $expression['family_replacement']) : $matches[1];
                $result['major']  = isset($expression['major_replacement']) ? $expression['major_replacement'] : $matches[2];
                $result['minor']  = isset($expression['minor_replacement']) ? $expression['minor_replacement'] : $matches[3];
                $result['patch']  = isset($expression['patch_replacement']) ? $expression['patch_replacement'] : $matches[4];

                return $result;
            }
        }

        return $result;
    }