3v4l.org

run code in 500+ PHP versions simultaneously
<?php $re = '/<td.*?>.*?<p>(.*?)<\/p>.*?<\/td>/s'; $str = '<table width="652"> <tbody> <tr> <td colspan="2" width="652"> <p><strong>Test header</strong></p> </td> </tr> <tr> <td width="21"> <p>Nr.</p> </td> <td width="178"> <p><strong>Test2</strong></p> </td> </tr> <tr> <td rowspan="2" width="21"> <p>1</p> </td> <td rowspan="2" width="178"> <p>Test3</p> </td> </tr> </tbody> </table>'; $subst = '<td>$1</td>'; Echo "before: \n"; Var_dump($str); Echo "\n\nafter:\n"; $result = preg_replace($re, $subst, $str); Var_dump($result); //echo "The result of the substitution is ".$result;

preferences:
118.63 ms | 1611 KiB | 5 Q