Jump to content

Regular expressions in JavaScript: Convert one type of tag to another in string?


Recommended Posts

Hello,

I have an odd project where I'm converting HTML from a text editor into SSML to be processed. So far all is good but regex makes my brain explode today.  :o

 

Any thoughts on how to convert something like this:

<span class="rcPitchXHigh" title="pitch: x-high" alt="pitch">blah blah</span>

into this:

<prosody pitch="x-high">blah blah</prosody>

using JavaScript?

 

I was thinking about doing this with PHP eventually, but if I can keep it all on the client side, all the better.

 

Thanks much in advance for any pointers big or small. Let me know if I can provide more advanced examples. I'll fill in the gaps if I figure it out first. :)

 

Best regards,

 

Chris

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.