Could you please help me to a string inside a string when start and end are given. Actually I want to delete all the contents between //[langStart-en] and //[langEnd-en] in the following example
//[langStart-en] This is a test //[langEnd-en]
using preg_replace. I used the following code
$string = '//[langStart-en] This is a test //[langEnd-en]';
$pattern = '/\/\/\[langStart-en\][^n]*\/\/\[langEnd-en\]/';
$replacement = '//[langStart-en]//[langEnd-en]';
$my_string = preg_replace($pattern, $replacement, $string);
echo $my_string;
It is showing the following error
Warning: preg_replace() [function.preg-replace]: Unknown modifier '/' : eval()'d code on line 4"
Please help