dallypost Posted February 10, 2009 Share Posted February 10, 2009 I have a block of text stored in a string that includes [keywords]some random text[/keywords] I want to replace [keywords], [/keywords] and everything in between with "" (nothing) I have been trying many versions of this: $string=ereg_replace("regex expression", "", $string); Nothing seems to work. I know that this is probably pretty basic but regular expressions just about kill me. Thanks for your help Lance Link to comment https://forums.phpfreaks.com/topic/144703-ereg_replace-remove-text-that-begins-with-___-and-ends-with-___/ Share on other sites More sharing options...
.josh Posted February 11, 2009 Share Posted February 11, 2009 $string = preg_replace('~\[keywords\].*?\[/keywords\]~','',$string); Link to comment https://forums.phpfreaks.com/topic/144703-ereg_replace-remove-text-that-begins-with-___-and-ends-with-___/#findComment-759376 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.