I have problem with this “simple” code:
$img_oryg = '<igm class="aligncenter" src="(oryginal img source)" alt="some text | some text">';
$replace_with = '<div class="ivcs_holder"><igm class="aligncenter" src="(oryginal img source)" alt="some text | some text" /></div>';
$content = preg_replace("#$img_oryg#s", $replace_with , $contetn );
echo $content;
This is ofcourse a sample code, and everything is coded inside a loop, which overlap each image with divs, and also doeas some other stuff.
Problem is in | that can be added to alt-tag of image. If it is present, then code behave strangely and result is not correct.
Anybody does know how to deal with strings like that?
it should be ok as long as you run preg_quote on your regex pattern. the
|character has a special meaning in regex, so this is why it would cause problems.