sspoke Posted December 1, 2010 Share Posted December 1, 2010 How am i to do this either a php builtin function i am unaware about or something simple with regular expressions replacing I need a way to remove whitespace (tabs,spaces,newlines,etc) and anything else that seperates <> tags such as <td class="subject solvedbg"> <div> <span id="msg_1">blah blah space see <a href="blahblah> </div> </td> to <td class="subject solvedbg"><div><span id="msg_1">blah blah space see<a href="blahblah></div></td> Thank you. Link to comment https://forums.phpfreaks.com/topic/220372-trim-whitespace-from-left-and-right-of-html-tags/ Share on other sites More sharing options...
Rifts Posted December 1, 2010 Share Posted December 1, 2010 http://www.websiteoptimization.com/speed/tweak/whitespace/ Link to comment https://forums.phpfreaks.com/topic/220372-trim-whitespace-from-left-and-right-of-html-tags/#findComment-1141932 Share on other sites More sharing options...
AbraCadaver Posted December 1, 2010 Share Posted December 1, 2010 Several ways, here's one: $new = preg_replace('/[\s]+(<)|(>)[\s]+/', '$2$1', $old); Link to comment https://forums.phpfreaks.com/topic/220372-trim-whitespace-from-left-and-right-of-html-tags/#findComment-1141983 Share on other sites More sharing options...
sspoke Posted December 2, 2010 Author Share Posted December 2, 2010 nice one abra and also thanks rifts good read Link to comment https://forums.phpfreaks.com/topic/220372-trim-whitespace-from-left-and-right-of-html-tags/#findComment-1142033 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.