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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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