| | $delim = $pattern[0]; |
| | $inner = substr($pattern, 1, strrpos($pattern, $delim) - 1); |
| | - $patterns[] = "(?P<punctuation>[\\{\\}\\(\\)\\[\\]\\;\\,])"; |
| | + $patterns[] = "(?P<$name>$inner)"; |
| | } |
| | + |
| | + $patterns[] = "(?P<punctuation>[\\{\\}\\(\\)\\[\\]\\;\\,])"; |
| | |
| | $combined = '/' . implode('|', $patterns) . '/msu'; |
| | |
| | - return preg_replace_callback($combined, function ($matches) { |
| | + $result = preg_replace_callback($combined, function ($matches) { |
| | foreach ($matches as $key => $value) { |
| | if (!is_numeric($key) && $value !== '') { |
 |
| | return htmlspecialchars($matches[0]); |
| | }, $this->content); |
| | + |
| | + return $result ?? htmlspecialchars($this->content); |
| | } |
| | |