I am trying to replace every match of the following string with '' but leave the curly brackets and the text inside. There is also text surrounding the span elements, and there are multiple tags with tag_item varying and Tag title varying.
Example string:
Text text text text
<span contenteditable="false" data-tag="{{tag_item}}">Tag Title</span>
Text text text text
<span contenteditable="false" data-tag="{{tag_item2}}">Tag Title2</span>
Text text text text
And I would like it to become:
Text text text text
{{tag_item}}
Text text text text
{{tag_item2}}
Text text text text
Here is what I have so far, and it is not working:
$message = preg_replace('/" contenteditable="false">(.*)<\/span>/i', '', $message);
$message = str_replace('<span data-tag="', '', $message);
Thanks in advance.
{{tags}}and throwing everything else away be simpler?<span ..?