I would not use `preg_replace` here. If you need the media player without a script, they should be separate templates. Removing already "rendered" content is a waste of process time.