$match) { $prefix = $match[1]; $url = $match[2]; $tokenID = $this->makeTokenID((string)$idx); $elements[$idx] = []; $elements[$idx]['matchString'] = $url; if (in_array('subst', $this->parameters, true)) { // Replace the URL with a token in the content $modifiedContent = str_replace($prefix . $url, $prefix . '{softref:' . $tokenID . '}', $modifiedContent); $elements[$idx]['subst'] = [ 'type' => 'string', 'tokenID' => $tokenID, 'tokenValue' => $url, ]; } } } return SoftReferenceParserResult::create( substr($modifiedContent, 1, -1), $elements ); } }