preg_replace()

From: Date: Mon, 14 Apr 2003 16:32:02 +0000
Subject: preg_replace()
Groups: php.general 
Request: Send a blank email to php-general+get-143801@lists.php.net to get a copy of this message
I have a table in which I want to add an ID to each cell, using preg_replace. $mytable = "<table> <tr> <td>cell 1</td> <td>cell2</td> </tr> </table>"; echo preg_replace("/<td>/i", "<td id=number>",$mytable); The output I want is this: <table> <tr> <td id=1>cell 1</td> <td id=2>cell2</td> </tr> </table> Can this be done? I have been frying my brain with this now for two days... Any thoughts?

« previous php.general (#143801) next »