Jump to content

[SOLVED] Substring using preg_replace


burhankhan

Recommended Posts

Hi:

 

I want to remove sub string from a string.

 

Criteria is like this:

 

this is starting of string [tag][tag] here is some other code[/tag]here is some code[/tag] this is ending of string...

 

You can see in this string there are many nested [tags].

 

I just want to remove those all nested tags. And out put should be:

 

this is starting of string  this is ending of string...

 

I have tried many patterns but useless.

Any help will be highly appreciated.

 

Thanks

Burhan Khan

Link to comment
https://forums.phpfreaks.com/topic/59142-solved-substring-using-preg_replace/
Share on other sites

I have tried your script but it is not working with this string:

 

 

 [quote][quote]this is quote 3[/quote]this is qutoe 2[/quote]this is in the quote

 

It should return this:

this is in the quote

 

But it is returning this:

 

this is qutoe 2[ /quote ]this is in the quote

 

Any suggestion?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.