PHP Regex to remove non-related content but leave content within blocks -


I need help to fix my regex, say that the text is as follows:

 Bladder bla1 bla1 bla1 bla1 bla bla bla2 something else bla bla bla i think bla1 and bla2 removed everything Gone, can anyone help me with those tags?  

Thank you.

To delete the tag, try again:

  $ Str = 'bla bla [bla1] some [/ bla1] bla bla [bla2] something else [/ bla2] bla bla bla'; $ Result = preg_replace ('~ \ [([^ \]] +) \]. *? \ [/ \\ 1 \] ~', '', $ str); Var_dump ($ result);    

Comments