public function replaceBlock($blockname, $replacement) { preg_match( '/\$\{' . $blockname . '}.*\$\{\/' . $blockname . '}/is', $this->tempDocumentMainPart, $matches ); if (isset($matches[0])) { $this->tempDocumentMainPart = str_replace( $matches[0], $replacement, $this->tempDocumentMainPart );} }