I've found many examples on the internet, but still can't find a solution for this. I got a PHP page that needs to parse a HTML+JS page and needs to remove everything included between { } and also the brackets itself. The point is that the content of the brackets must be [A-Za-z0-9_] and not anything else (like i did so far).
This is my current replace:
$this->content = preg_replace("/\{((?:[^{}]++|\{(?1)\})++)\}/", "", $this->content);
So far now this works pretty good, the point is that doesn't search for right contents between brackets and removes them no matter what's inside (atm it's removing JS functions from the content of the page that is parsing).
What do I've to modify to add that kind of character restriction to the content of the reg-ex?
Thanks