config['regexps']; $tagName = $this->config['tagName']; $attrName = $this->config['attrName']; $onlyFirst = !empty($this->config['onlyFirst']); $keywords = []; foreach ($regexps as $regexp) { preg_match_all($regexp, $text, $matches, PREG_OFFSET_CAPTURE); foreach ($matches[0] as list($value, $pos)) { if ($onlyFirst) { if (isset($keywords[$value])) { continue; } $keywords[$value] = 1; } $this->parser->addSelfClosingTag($tagName, $pos, strlen($value)) ->setAttribute($attrName, $value); } } } }