public function replace($regexp, $template, $tagName = null)
	{
		if (!isset($tagName))
		{
			$tagName = 'PREG_' . strtoupper(dechex(crc32($regexp)));
		}
		$this->parseRegexp($regexp);
		$this->parseTemplate($template);

		$passthroughIdx = $this->getPassthroughCapture();
		if ($passthroughIdx)
		{
			$this->captures[$passthroughIdx]['passthrough'] = true;
		}

		$regexp   = $this->fixUnnamedCaptures($regexp);
		$template = $this->convertTemplate($template, $passthroughIdx);

		$this->collection[] = [$tagName, $regexp, $passthroughIdx];

		return $this->createTag($tagName, $template);
	}
public function replace($regexp, $template, $tagName = null)
	{
		if (!isset($tagName))
		{
			$tagName = 'PREG_' . strtoupper(dechex(crc32($regexp)));
		}
		$this->parseRegexp($regexp);
		$this->parseTemplate($template);

		$passthroughIdx = $this->getPassthroughCapture();
		if ($passthroughIdx)
		{
			$this->captures[$passthroughIdx]['passthrough'] = true;
		}

		$regexp   = $this->fixUnnamedCaptures($regexp);
		$template = $this->convertTemplate($template, $passthroughIdx);

		$this->collection[] = [$tagName, $regexp, $passthroughIdx];

		return $this->createTag($tagName, $template);
	}
public function replace ( $ regexp , $ template , $ tagName = null ) { if ( ! isset ( $ tagName ) ) { $ tagName = 'PREG_' . strtoupper ( dechex ( crc32 ( $ regexp ) ) ) ; } $ this -> parseRegexp ( $ regexp ) ; $ this -> parseTemplate ( $ template ) ; $ passthroughIdx = $ this -> getPassthroughCapture ( ) ; if ( $ passthroughIdx ) { $ this -> captures [ $ passthroughIdx ] [ 'passthrough' ] = true ; } $ regexp = $ this -> fixUnnamedCaptures ( $ regexp ) ; $ template = $ this -> convertTemplate ( $ template , $ passthroughIdx ) ; $ this -> collection [ ] = [ $ tagName , $ regexp , $ passthroughIdx ] ; return $ this -> createTag ( $ tagName , $ template ) ; }
Configure a pattern-based replacement

@param  string $regexp   Regexp to be used by the parser
@param  string $template Template to be used for rendering
@param  string $tagName  Name of the tag to create. A name based on the regexp is
automatically generated if none is provided
@return Tag              The tag created to represent this replacement
Configure a pattern - based replacement