loki421
06-29-2010, 12:51 AM
Hi guys,
I am trying to escape an empty tag in a string.
I have a bizzare error when I pass a RichTextEditor HTML text to a string, if I add a line break before I start the bullet points, it adds an empty <li></li> which I would like to remove.
Here's the code I'm using to escape the rest of the formating:
private function scanTxt():void{
txtVar = richtexteditor.htmlText;
var pattern:RegExp = /<TEXTFORMAT.*?>/g;
txtVar = txtVar.replace(pattern, "");
pattern = /<FONT.*?>/g;
txtVar = txtVar.replace(pattern, "");
pattern = /<\/FONT.*?>/g;
txtVar = txtVar.replace(pattern, "");
pattern = /<\/TEXTFORMAT.*?>/g;
txtVar = txtVar.replace(pattern, "");
// this is where i'm stuck, i want it to look for <li></li> (an empty list item tag)
pattern = /<\/LI><\//LI>/g;
}
Does anyone know what the correct syntax is to look for an empty tag and escape it?
Or, is there something I'm doing wrong to get the extra <li> at the beginning of any bullet lists i insert?
Any help would be gratefully received!
Thanks in advance all! :)
I am trying to escape an empty tag in a string.
I have a bizzare error when I pass a RichTextEditor HTML text to a string, if I add a line break before I start the bullet points, it adds an empty <li></li> which I would like to remove.
Here's the code I'm using to escape the rest of the formating:
private function scanTxt():void{
txtVar = richtexteditor.htmlText;
var pattern:RegExp = /<TEXTFORMAT.*?>/g;
txtVar = txtVar.replace(pattern, "");
pattern = /<FONT.*?>/g;
txtVar = txtVar.replace(pattern, "");
pattern = /<\/FONT.*?>/g;
txtVar = txtVar.replace(pattern, "");
pattern = /<\/TEXTFORMAT.*?>/g;
txtVar = txtVar.replace(pattern, "");
// this is where i'm stuck, i want it to look for <li></li> (an empty list item tag)
pattern = /<\/LI><\//LI>/g;
}
Does anyone know what the correct syntax is to look for an empty tag and escape it?
Or, is there something I'm doing wrong to get the extra <li> at the beginning of any bullet lists i insert?
Any help would be gratefully received!
Thanks in advance all! :)