DeviceDetector\Parser\ParserAbstract::matchUserAgent PHP Method

matchUserAgent() protected method

Matches the useragent against the given regex
protected matchUserAgent ( $regex ) : array | boolean
$regex
return array | boolean
    protected function matchUserAgent($regex)
    {
        // only match if useragent begins with given regex or there is no letter before it
        $regex = '/(?:^|[^A-Z0-9\\-_]|[^A-Z0-9\\-]_|sprd-)(?:' . str_replace('/', '\\/', $regex) . ')/i';
        if (preg_match($regex, $this->userAgent, $matches)) {
            return $matches;
        }
        return false;
    }