CSS Tips CSS Tips

22Feb/120

AS3 Tutorial: Remove HTML Tags From User Posted Content

In my chat room one of the problems I ran into was allowing formatting of their messages (ie font colors) but preventing them from posting HTML tags. So I came up with this nifty function. Run it on their content before adding your own HTML to the mix.

1
private function stripTags(str:String){    var validAlphaNumericRegExp:RegExp = /</gi;    return str.replace(validAlphaNumericRegExp, "<");}
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.