paritycheck Posted May 1, 2007 Share Posted May 1, 2007 Hi guys Im in a fix... I need to work on a regular expression or a snippet that searches a given string for html opening and closing tags... and what it does is that it moves all closing html tags to the end of the string and all opening tags to the beginning of the string..so for example lets say this string: stuff one <span style="blablaba">text tex <strong>somesome text </strong>more text more text </span> ending stuff becomes this: <span style="blablaba"><strong>stuff one text tex somesome text more text more text ending stuff</strong></span> ANy one have any ideas or tips please do share... Thanks again in advance Quote Link to comment Share on other sites More sharing options...
fenway Posted May 1, 2007 Share Posted May 1, 2007 There are lots of tools (like htmltidy) that do this sort of thing.. regexes such as this are very complex. Quote Link to comment Share on other sites More sharing options...
nogray Posted May 1, 2007 Share Posted May 1, 2007 You'll have a hard time with this because firefox doesn't support the $1, $2, ... $9 which you'll need to use to replace in the string. Quote Link to comment Share on other sites More sharing options...
paritycheck Posted May 2, 2007 Author Share Posted May 2, 2007 The thing is that I'm making a plug in for tiny MCE editor which imitates the format painter option in MS Outlook. WHat is does is that you select some text and when you clcik the option it applies the style of the first element selected to all the text. I pretty much hacked at the idea.. but if theres an easy way to do this please do help.... Quote Link to comment 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.