Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 24, 2012 10:46 AM by Song-Tian - MSFT
May 23, 2012 08:41 PM|LINK
I am new at using the ajax editor. I need a method where user can paste into a text field from MS Word or other applications.
I need to be able to remove the HTML tags from the text.
I have tried the paste from MS Word with Cleanup but nothing is happening. Do I need to write my own code behind this button ?
If there is another way of doing it I would be happy to try that.
May 24, 2012 03:25 AM|LINK
Refer this thread
May 24, 2012 10:46 AM|LINK
I think you may need regular expression to do that.
static string SanitizeHtml(string html)
string acceptable = "script|link|title";
string stringPattern = @"</?(?(?=" + acceptable + @")notag|[a-zA-Z0-9]+)(?:\s[a-zA-Z0-9\-]+=?(?:(["",']?).*?\1?)?)*\s*/?>";
return Regex.Replace(html, stringPattern, "sausage");