ASP replaces labels in Word with regular expressions and becomes plain text _ Apply Tips

Source: Internet
Author: User
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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.