In this string - "This <B>is</B> just <B>an</B> example" - I want to change all <B> and </B> to <I> and </I>. I know ways to do it with this string, but as it says it's only an example.
I've tried this:
$string = "This <B>is</B> just <B>an</B> example.";
$string = eregi_replace("<B>(.+)</B>", "<I>\\1</I>", $string);
But it returns:
"This <I>is</B> just <B>an</I> example."
I can't use:
$string = eregi_replace("<B>([^<]+)</B>", "<I>\\1</I>", $string);
because I want it to be possible to have a < in between.
Is what I'm asking for possible, or do I have to solve it with other functions? Which functions then?