As it's said in the message, removed the e
modifier:
'#§\\(\\[a-z0-9-_\\]+\\)\.?\\(\\[a-z0-9-_\\]+\\)?#i'
// here ___^
And there're no needs to escape all these characters:
'#§([a-z0-9_-]+)\.?([a-z0-9_-]+)?#i'
[a-z0-9_]
can be rewritten \w
and there're no needs to i
modifier
'#§([\w-]+)\.?([\w-]+)?#'
The whole instruction becomes:
$buffer = preg_replace_callback(
'#§([\w-]+)\.?([\w-]+)?#',
function ($m) {
return templ($m[1], $m[2]);
},
$buffer
);