diff --git a/filter/mathjaxloader/classes/text_filter.php b/filter/mathjaxloader/classes/text_filter.php index 8578fb4364f86..dd93961fe2c51 100644 --- a/filter/mathjaxloader/classes/text_filter.php +++ b/filter/mathjaxloader/classes/text_filter.php @@ -246,7 +246,7 @@ protected function insert_span($text, $start, $end) { * @return string Returns the input string with HTML tags escaped. */ private function escape_html_tag_wrapper(string $text): string { - return preg_replace_callback('/\{([^}]+)\}/', function (array $matches): string { + return preg_replace_callback('/\{[^}]*<[^}]+>[^}]*\}/', function (array $matches): string { $search = ['<', '>']; $replace = ['<', '>']; return str_replace($search, $replace, $matches[0]);