I try to replace my content. I use ereg_replace how should I do <?php $content = 'Some men keep trying and never get anywhere with dating'; $content = ereg_replace('[color=red]x[/color]','',$content); // I want cut before 'trying' $content = ereg_replace('[color=blue]y[/color]','',$content); //I want cunt after 'anywhere' echo $content; // result = 'trying and never get anywhere' ?> Code (markup): what regular expression that use in x and y
what are you trying to achieve? Are you always going to cut the same string for result and will you always use the same string to start? Or if strings going to be different, is there a set pattern? Maybe if you give me more info, I can help.