I have some dynamic markup i need to clean up and I think some kind of regex is the way to go. The dynamic part is parameters in an onclick JS call, so I can't use a generic search and replace. sample line from markup i am parsing: <div class="oddsTableLink" onclick="OpenLink('1236', '140345078', '1');""> PHP: I want to delete every attribute in this div to just be left with <div> PHP: can anyone show me how? I found a regex to delete the content BETWEEN my delimiters but not the actual delimiters themselves. any help appreciated a total regex noob
<?php $html = <<<HTML <div class="oddsTableLink" onclick="OpenLink('1236', '140345078', '1');"">'; HTML preg_match('/<div([^>]+)>/si', $html, $m); $clean = str_replace($m[1], '', $html); ?> Code (markup):