Skip to content

Commit fb43fa6

Browse files
authored
Fix TemplateProcessor :: fixBrokenMacros;
The current regex causes the loss of the original formatting of some documents after the variables have been overwritten. Replaces the current regex with one that resolves this problem. New regex from @brainwood /\$(?:\{|[^{$]*\>\{)[^}$]*\}/U The brainwood's pull request was rejected due to pipe regex delimiters "|"
1 parent 1876062 commit fb43fa6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/PhpWord/TemplateProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ protected function fixBrokenMacros($documentPart)
445445
$fixedDocumentPart = $documentPart;
446446

447447
$fixedDocumentPart = preg_replace_callback(
448-
'|\$[^{]*\{[^}]*\}|U',
448+
'/\$(?:\{|[^{$]*\>\{)[^}$]*\}/U',
449449
function ($match) {
450450
return strip_tags($match[0]);
451451
},

0 commit comments

Comments
 (0)