However, as my host upgraded to PHP 5.3, I get eregi is deprecated warning. I tried to convert my script to preg_replace like below but it is not working:
@liyenn, presuming that the two div tags you’re searching are on different lines, then you’ll need to use the s pattern modifier.
$print[1] = preg_replace('~<div id="countdown">(.*)<div id="rightcontent">~Uis', '<div id="rightcontent">',$print[1]);
#by using single quotes to surround our expression and replacement pattern, we no longer have to escape every double quote inside.
Running the above code on:
<div id="countdown">test
<div id="rightcontent">
test
</div></div>
<div id="countdown">test
<div id="rightcontent">
test
</div></div>
Will produce the following:
<div id="rightcontent">
test
</div></div>
<div id="rightcontent">
test
</div></div>
However as you can see, we are left with an overhang of closing div tags, so perhaps you should try the following regular expression: