When a company customer uses a Web site editor to add changes, it is often copied directly from the Word document to the editor and then submitted. The result is a variety of styles on the Content Display page, and sometimes some plain text content is used as an excerpt, all of which need to clear word formatting. Changing the customer's habit it is difficult to copy the client into Notepad and paste it into the editor, so change from our own. Baidu from the Internet a number of clear word format of the regular, the use of the effect is not ideal, so I wrote a clear word format of the ASP function, to meet our own use needs. The functions are as follows:
Copy Code code as follows:
function Cleanword (HTML)
Dim regEx
Set Regex=new REGEXP
Regex.ignorecase=true
Regex.global=true
Regex.pattern= "<[^>]*>" clears the contents of all <>
HTML = regex.replace (HTML, "")
Regex.pattern= ' {[^}]*} ' clears the contents of all {}
HTML = regex.replace (HTML, "")
Regex.pattern= "/[^/]*/" clears comments between all/**/
HTML = regex.replace (HTML, "")
HTML =replace (HTML, "table"). MsoNormalTable "," "") ' replaces the word from the escape
cleanword= html
Set regex=nothing
End Function