public function str( $remove = true )
	{
		if( $remove === false ) {
			return $this->_text;
		}

		$matches = array();
		$text = $this->_text;

		$regex = '/' . str_replace( '\$', '(.*)', preg_quote( $this->_begin, '/' ) ) . '/U';
		if( preg_match_all( $regex, $text, $matches ) === false ) {
			throw new MW_Template_Exception( sprintf( 'Invalid regular expression: %1$s', $regex ) );
		}

		$matches = array_unique( $matches[1] );
		foreach( $matches as $match )
		{
			$begin = str_replace( '\$', $match, preg_quote( $this->_begin, '/' ) );
			$end = str_replace( '\$', $match, preg_quote( $this->_end, '/' ) );

			$regex = '/' . $begin . '.*' . $end . '/smU';
			if( ( $text = preg_replace( $regex, '', $text ) ) === null ) {
				throw new MW_Template_Exception( sprintf( 'Invalid regular expression: %1$s', $regex ) );
			}
		}

		return $text;
	}
public function str( $remove = true )
	{
		if( $remove === false ) {
			return $this->_text;
		}

		$matches = array();
		$text = $this->_text;

		$regex = '/' . str_replace( '\$', '(.*)', preg_quote( $this->_begin, '/' ) ) . '/U';
		if( preg_match_all( $regex, $text, $matches ) === false ) {
			throw new MW_Template_Exception( sprintf( 'Invalid regular expression: %1$s', $regex ) );
		}

		$matches = array_unique( $matches[1] );
		foreach( $matches as $match )
		{
			$begin = str_replace( '\$', $match, preg_quote( $this->_begin, '/' ) );
			$end = str_replace( '\$', $match, preg_quote( $this->_end, '/' ) );

			$regex = '/' . $begin . '.*' . $end . '/smU';
			if( ( $text = preg_replace( $regex, '', $text ) ) === null ) {
				throw new MW_Template_Exception( sprintf( 'Invalid regular expression: %1$s', $regex ) );
			}
		}

		return $text;
	}
public function str ( $ remove = true ) { if ( $ remove === false ) { return $ this -> _text ; } $ matches = array ( ) ; $ text = $ this -> _text ; $ regex = '/' . str_replace ( '\$' , '(.*)' , preg_quote ( $ this -> _begin , '/' ) ) . '/U' ; if ( preg_match_all ( $ regex , $ text , $ matches ) === false ) { throw new MW_Template_Exception ( sprintf ( 'Invalid regular expression: %1$s' , $ regex ) ) ; } $ matches = array_unique ( $ matches [ 1 ] ) ; foreach ( $ matches as $ match ) { $ begin = str_replace ( '\$' , $ match , preg_quote ( $ this -> _begin , '/' ) ) ; $ end = str_replace ( '\$' , $ match , preg_quote ( $ this -> _end , '/' ) ) ; $ regex = '/' . $ begin . '.*' . $ end . '/smU' ; if ( ( $ text = preg_replace ( $ regex , '' , $ text ) ) === null ) { throw new MW_Template_Exception ( sprintf ( 'Invalid regular expression: %1$s' , $ regex ) ) ; } } return $ text ; }
Generates the template by replacing substrings and remove markers.

@param boolean $remove Remove still disabled markers from statement
@return string
Generates the template by replacing substrings and remove markers .