I tried:
echo preg_replace('<!--hello//-->','','<p>This is some text<!--hello//-->This is some more text</p>');
Trying to return
<p>This is some textThis is some more text</p>
But instead I got
<p>This is some text<>This is some more text</p>
Why do the brackets remain in the string?
Thanks for the help!
Edit: This question is not looking for the right regex to use...it's moreso why the function preg_replace is behaving weirdly.
'~<!--hello//-->~'. Or just usestr_replaceif you plan to remove a fixed substring. See ideone.com/OlAXUY.<and>are parsed as paired regex delimiters. Thus, you need to use more common ones,/or~, in addition to your pattern.<and>were being treated as delimiters