fork download
  1. <?php
  2.  
  3. $html = $original = <<<HTML
  4. <br class="clearfix" /><ul class="tml-action-links">
  5. <li><a href="http://localhost/robinhood/register/" rel="nofollow">Register</a></li>
  6. <li><a href="http://localhost/robinhood/lostpassword/" rel="nofollow">Lost Password</a></li>
  7. </ul>
  8. HTML;
  9.  
  10. preg_match('(<ul class="tml-action-links">(.*?)<\/ul>)s', $html, $matches);
  11.  
  12. $html = $matches[0];
  13.  
  14. $html = str_replace('<li>', '<li class="peehaa">', $html);
  15. $html = str_replace($matches[0], $html, $original);
  16.  
  17. echo $html;
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
<br class="clearfix" /><ul class="tml-action-links">
<li class="peehaa"><a href="http://localhost/robinhood/register/" rel="nofollow">Register</a></li>
<li class="peehaa"><a href="http://localhost/robinhood/lostpassword/" rel="nofollow">Lost Password</a></li>
</ul>