I'm developing a word finder of a large text using flex. There I use a RichEditableText to show the whole text and when I find for a word I want to represent all the matching words of that text in a different colour. So I replace all the matching words with html colour changing tags as follows.
var replacedContent:String = txtRichBox.Text.replace(new RegExp(txtSearch.text,"g"), "<font color='#ff0000'>"+txtSearch.text+"</font>");
And then I set it to the RichEditableText as a HTML as follows.
txtRichBox.textFlow = TextConverter.importToFlow(replacedContent, TextConverter.TEXT_FIELD_HTML_FORMAT);
This works supper fine.
Now I have a new requirement. There the original text can be a XML. Then if I set the XML with colour changing html tags to the RichEditableText as a HTML everything crash because it takes XML tags also as HTML tags.
So I tried to replace < and > sings of the XML with < and >.
//Replace < with <
replacedContent:String = txtFileContent.text.replace(new RegExp("<","g"), "<");
//Replace > with >
replacedContent = replacedContent.replace(new RegExp(">","g"), ">");
Then RichEditableText won't render them back to < and > sings. It shows < and > as it is.
Can anyone suggest me a solution for this?