Off Topic Code Question

So I am messing with some code to bring it up to snuff with php 7 needs. I have pretty :much got it all good to go but 1 line. Literally, 1 line.

$message .= str\_replace('\"', '"', substr(preg\_replace('#(\\>(((?\>([^\>\<]+|(?R)))\*)\\<))#se', "preg\_replace(\$orig, \$repl, '\\0')", '\>' . $seg . '\<'), 1, -1));

This code as we know just by looking at it is a pile of errors waiting to happen.I get the following error exactly as I had suspected I should.

Quote

Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead

Now I have used the callback and everything in between and I get errors no matter what. The odd part is I have fixed no less than 25 of these in this code i am working on. However, this one is just sticking a boot in my @ss. I am not sure wh=y I can not get this one line out of all of them to work. It is probably something so simple and right under my nose. I have been working all night while laying in bed in the hospital and probably have just done to much for the night/day and just need to stop and ask like I have done here.

What say ye code gurus?

What are the errors? And what exactly are you trying to do? That is a nasty regex