Hello everyone, I am building a templating system for my custom CMS and I want to replace tags that begin with { and end with } in HTML files with my own text.
I did this using the following regular expression
$render_page = preg_replace(‘/{+.*?}/im’,”, $render_page);
Now the problem that I am facing is that some times usefull text that it is not a translation tag is included in {}.
The most usefull solution I can think of is to restrict tags to not contain any spaces so {useful_tag} wil be replaced but { start_with_spaces } or {contains spaces} will not get replaced.
Could you please help with the regular expression?
Other suggestions are also welcome.