regex - PHP regexp remove tags between [] marquers -


say have

$content = "some text [again < dummy1>< /dummy1> te < dummy2>< /dummy2>< /dummy3>xt] keep theses < needkeeped>xxx< needkeeped>" 

i want remove tags < dummyx> but, want tags witch between [ , ] chars

expected result be

$content = "some text [again text] keep theses `< needkeeped>xxx< needkeeped>"` 

i tried

preg_replace('/<[^>]*>/', '', $content) 

but removed tags

preg_replace_callback('/\[[^\]]+\]/', function($matches){     return preg_replace('/<[^>]*>/', '', $matches[0]); }, $content); 

first, find square bracketed regions, replace tags within them.

http://ideone.com/wmyfxs


Comments