SaMike Posted May 3, 2010 Share Posted May 3, 2010 Hi, i'd like to delete all parts like this from my string: <td class="vertTh"> blahblahbalbhalbha </td> So i want to delete everything that is between <td class="vertTh"> and </td>. There's multiple of these in string (the amount may vary). Example: if my string would be HI!<br> My name is Peter!<br> <td class="vertTh"> bloabfsdff </td> I'm a cat!<br /> <td class="vertTh"> asdadsadasdasdas dafmauahahahahahaa </td> being cat is fun! Would come: HI!<br> My name is Peter!<br> I'm a cat!<br> Being cat is fun! How would i achieve this? Link to comment https://forums.phpfreaks.com/topic/200551-delete-parts-of-string/ Share on other sites More sharing options...
Ken2k7 Posted May 3, 2010 Share Posted May 3, 2010 Well, if you want to hide it, you can just use a simple CSS rule. Otherwise, you can use: preg_replace('#<td class="vertTh">.+?</td>#i', '', $str); Link to comment https://forums.phpfreaks.com/topic/200551-delete-parts-of-string/#findComment-1052342 Share on other sites More sharing options...
siric Posted May 3, 2010 Share Posted May 3, 2010 Have a look at this thread. http://www.phpfreaks.com/forums/index.php/topic,296528.msg1404407.html#msg1404407 Link to comment https://forums.phpfreaks.com/topic/200551-delete-parts-of-string/#findComment-1052457 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.