I saw a couple of post about removing all the formatting tags from
htmlText and came up with this solution that uses RegExp.

I am not completely satisfied with the form though it works. If anyone
has any suggestions for improvement or if there is an easier way that
I am missing let me know. 

function removeHTMLTags(Str):String{
  var matchArr = Str.match(/>[a-zA-Z0-9\/][^<]*</g)
// returns raw text but with a leading '>' and trailing '<'
// then loop to remove the brackets and adds a space to the text
  var newStr:String = ""
  for each(var matchItem in matchArr){
       var mStr = matchItem.substring(1,matchItem.length-1)+" "
        newStr += mStr
  }
return newStr

}

I had no luck using a replace(regX,"") to try and remove all <xxx>
tags for some reason. Maybe someone can shed some light on that too.





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to