Reply
fun with regex
Old 07-06-2004, 02:23 PM fun with regex
Junior Talker

Posts: 1
Hi,

I need to change all the <td> and </td> tags to <th> and </th> tags respectively with the first set of <tr></tr> in a html string.

There will be multiple tables within the string too.

Any advice would be appreciated.

thanks.
drobinson is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 07-08-2004, 07:27 AM try the preg_* family of functions
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
for instance

$string = preg_replace("/<th>/" , "<td>", $string);

if you have php5 you can use the str_replace() with the same syntax as above.

ibbo
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Reply     « Reply to fun with regex
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13807 seconds with 12 queries