Hi I want to replace the content between "<<" and ">>" with custom div class how can I do that?
I tried some regex but It didn't work.
$con = preg_replace ('/<<(.*?)>>/s', '<div>$1</div>', $con);
Hi I want to replace the content between "<<" and ">>" with custom div class how can I do that?
I tried some regex but It didn't work.
$con = preg_replace ('/<<(.*?)>>/s', '<div>$1</div>', $con);
I would propose putting the < and > in character classes:
preg_replace('/[<]{2}(.*?)[>]{2}/s', '<div>$1</div>', $con);
Escaping them should also work
preg_replace('/\<\<(.*?)\>\>/s', '<div>$1</div>', $con);
But CC001's comment above is correct: Neither one of these is needed.