Implement UBB Code

Source: Internet
Author: User

Last time, we talked about how to use the regular expression object in ASP to verify various data. This article describes the powerful functions of the regular expression object. Next,
Let's take a look at other functions related to the regular expression object. When surfing the Internet, especially when browsing various forums, we often see "UBB Code"
This word. What is UBB code? UBB code is a variant of HTML and is the Ultimate Bulletin Board (a BBS program outside China, there are many places in China
This program) uses a special TAG. To prevent unintentional or intentional HTML code attacks on the Forum, HTM is basically blocked in various forums.
L code, but in order to make the forum more "colorful", the Forum will open some custom Tag tags, similar to tags in HTML, such
"[URL], [/URL], [RED], [/RED]", which provides functions equivalent to HTML code and avoids malicious attacks on the forum, these custom
Various tags are commonly known as UBB code. Currently, trendy forums support UBB code, such as http: // www. Chinaasp. Com
Technology Network) Forum is very good support for UBB code. Now, let's use the regular expression object to implement our own rich and colorful UBB code.
First, your Server (IIS or PWS) must have a support environment for VBScript5.0. Generally, IE5.X is installed to support regular expressions.
.
For the common methods and attribute usage of the "Regular Expression" object, I published the article "using the" Regular Expression "Object in ASP to verify data ".
For more information, see this article. Here, I will mainly introduce the method of implementing the regular expression object for "UBB code": Replace ()
Method.
The Replace method syntax is as follows:
Description
Replace the text found in the regular expression search.
Syntax
Object. Replace (string1, string2)
The syntax of the Replace method includes the following parts:
Partial description
Required. It is always the name of a RegExp object.
Required by string1. String1 is the string to be replaced by text.
Required by string2.
String2 is a replacement text string.
 
Description
The actual mode of the replaced text is set through the Pattern attribute of the RegExp object.
The Replace method returns a copy of string1, where the RegExp. Pattern text has been replaced with string2. If no matching text is found
The original copy of string1.
Next, we need to determine what UBB code we ultimately want to implement? The UBB code function we want to implement this time is as follows:

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.