lang="en-US"> Flash AS3 Tutorial: Remove HTML Tags –  Design1online.com, LLC

Flash AS3 Tutorial: Remove HTML Tags

In my chat room one of the problems I ran into was formatting messages (ie adding font colors) but preventing users from posting HTML tags. So I came up with this nifty function. Run it on their content and then add your HTML to the resulting string. This way their HTML tags are ignored but yours aren’t.

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

You may also like...

Leave a Reply