views:

32

answers:

1

Hi there. I have to use tinymce as a wysiwyg editor in a CMS to populate a flash app. I need to strip out the modern HTML in favor of something flash can use. Here's what I'm trying:

var initUnderline:RegExp = new RegExp('<span style="text-decoration: underline;">', "gi");
var endUnderline:RegExp = new RegExp("</span>", "gi");
var string:String = $.xmlData.content.landing.overview;//load the content from xml
var safeStr:String = string.replace(initUnderline, '<span style="text-decoration: underline;"><u>');
safeStr = string.replace(endUnderline, '</u></span>');

however, this only works for the endUnderline RegExp. The initial is not being replaced. Ideas?

I'm not great with regExps at all!

+1  A: 

There's nothing wrong with your regexp stuff per se.

The bug is that you need to run the second replace on safeStr, not on string:

var safeStr:String = string.replace(initUnderline, '<u>');
safeStr = safeStr.replace(endUnderline, '</u>');
Claus Wahlers
AAAAAAAAAAAAAHHH!!!!!!!!!!! I was so sure I had my reg ex wrong. Needed another set of eyes - thanks!
julie p