Below is my string. Here i use the preg_replace
$marr = '<ul><li class="test_item test-item-28 current_test_item">'.
'<a href="test/">Home</a></li><li class="test_item test-item-30">'.
'<a href="test/about-us/">About Us</a></li>'.
'<li class="test_item test-item-45"><a href="test/products/">Products</a></li>'.
'<li class="test_item test-item-47"><a href="test/latest-news/">Latest News</a></li>'.
'<li class="test_item test-item-49"><a href="test/contact-us/">Contact Us</a></li>'.
'</ul>';
echo preg_replace('/<li class="test_item test-item-45">(.*)<\/li>/',
'test',
$marr);
While using this, it replace the given string. But the latest news and contact menus are missing . In the out put the last 2 li are missing. What is wrong here?
Please help me. Thanks