public function setHighlights(array $highlights) {
    uksort($highlights, [$this, 'compareLength']);
    $this->_highlights = [];
    $pattern = '';
    foreach ($highlights as $string => $className) {
      $key = strtolower($string);
      $this->_highlights[$key] = $className;
      $pattern .= '|'.preg_quote($key);
    }
    $this->_pattern = '(('.substr($pattern, 1).'))ui';
  }