protected function matchUserAgent($regex) { $regex = '/(?:^|[^A-Z_-])(?:' . str_replace('/', '\\/', $regex) . ')/i'; if (preg_match($regex, $this->userAgent, $matches)) { return $matches; } return false; }