Skip to content
Snippets Groups Projects
Commit 925428bd authored by Kurucz István's avatar Kurucz István Committed by Kurucz István
Browse files

Issue #3362991 by nevergone: Unicode-compatible regexp with better matching

parent cbf67ee1
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ class TrimHtml extends FilterBase {
public function process($text, $langcode) {
// Remove all <br/> and empty (i.e. containing only whitespace or &nbsp;)
// <p> tags from the end of $text.
$pattern = '/((\s*<\s*p\s*>(&nbsp;|\s)*<\s*\/p\s*>\s*)|(\s*<\s*br\s*\/\s*>\s*))*$/';
$pattern = '/((\s*)|((?:<\s*p\s*>\s*(&nbsp;|\s)*<\s*\/p\s*>\s*)*)|(\s*<\s*br\s*\/\s*>\s*))*$/ui';
$text = preg_replace($pattern, '', $text);
return new FilterProcessResult($text);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment