Jump to content

Need a way to search and shift html tags in a string


paritycheck

Recommended Posts

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

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....

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.