kalster Posted June 14, 2015 Share Posted June 14, 2015 I have a line of text like this... <p>example<br /><br /><br /></p><br /> where the number of br tags before and after the </p> tag are unknown.I need the line displayed like this... <p>example</p><br /><br /></br /><br /> I need it in the preg_replace, where the part of the line begining with <p>example is untouched.Thank you in advanced. Link to comment https://forums.phpfreaks.com/topic/296810-move-tag-to-right-side-of/ Share on other sites More sharing options...
kalster Posted June 14, 2015 Author Share Posted June 14, 2015 Actually, i would like the line to be <p>example</p><br /> Link to comment https://forums.phpfreaks.com/topic/296810-move-tag-to-right-side-of/#findComment-1513863 Share on other sites More sharing options...
QuickOldCar Posted June 15, 2015 Share Posted June 15, 2015 I would remove any multiple breaks and place it back $string = "<p>example<br /><br /><br /></p><br />"; $string = preg_replace("~<br />+~",'',$string); $string .= "<br />"; Link to comment https://forums.phpfreaks.com/topic/296810-move-tag-to-right-side-of/#findComment-1513867 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.