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

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

uitableview - Create and use custom prototype table cells in xamarin ios using storyboard -