ted_chou12 Posted October 1, 2010 Share Posted October 1, 2010 Hi, I wish to match tags with self closed slashes and convert them to non self closed: eg. <br /> => <br> <img src="...." height="" .... /> => <img src="..." height="" ...> just replace the last two characters /> to > but they might be in a long text eg... <html> <br /> text.... this is a title page<img src="" height="" /> <table> ... </table> ... Thanks Ted Quote Link to comment https://forums.phpfreaks.com/topic/214955-matching-tags/ Share on other sites More sharing options...
sasa Posted October 2, 2010 Share Posted October 2, 2010 preg_replace('/\s*\/\s*>/', '>', $subject) Quote Link to comment https://forums.phpfreaks.com/topic/214955-matching-tags/#findComment-1118234 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.