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

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -