I am trying to use shortcode function on content after the body tag.
preg_match("/<body[^>]*>(.*?)<\/body>/is", $html, $matches);
$html= preg_replace("/<body[^>]*>(.*?)<\/body>/is",run_shortcodes($matches[1]), $body);
echo $html;
And this works ok but I would like to do this with preg_replace backreference if possible.
I have tried something like this but obviously it is wrong
$html= preg_replace("/<body[^>]*>(.*?)<\/body>/is",run_shortcodes('$1'), $body);
Can someone please show a possible example of using backreference.
Any help is appreciated .