Using "Regular Expression" objects in ASP to implement UBB style forum (turn)

Source: Internet
Author: User
Tags regular expression
Using "Regular Expression" objects in ASP to implement UBB-style forums
Paste language: Inadvertently found in the Chinese network of this article, said that this site forum UBB style of the realization of the principle, so posted out and share with everyone.
We talked about how to use the "regular expression" object in ASP to achieve a variety of data validation, the text describes the powerful function of regular expression objects, then we look at the "regular expression" object's other features. When we surf the internet, especially when browsing various forums, we often meet the word "UBB code". What is UBB code? UBB code is a variant of HTML, is Ultimate Bulletin Board (a foreign BBS program, there are many places in the domestic use of this program) a special tag. In order to avoid the user unintentional or intentional HTML code to attack the forum, the various forums basically blocked the HTML code, but in order to make the forum more "colorful", the forum will be appropriate to open some custom tag tag, similar to the HTML tag, for example, ", [red],[/ RED] ", in this way, can provide some equivalent to the HTML code features, but also avoid the forum to be malicious attacks, these custom tags are commonly known as UBB code." Today's trendy forums support UBB code, such as: http://www. Chinaasp. COM (Dynamic Technology Network) of the forum is very good support UBB code. Now, let's use the regular expression object together to implement our own colorful UBB code.
First of all, your server side (IIS or PWS) to have a VBScript5.0 support environment, generally refers to the installation of ie5.x can already support the "regular expression" object.
Common methods about regular expression objects, the use of the property, I in the "ASP" in the use of "regular expression" object to achieve data validation has been introduced in detail, you can see that article, here, I mainly introduce the implementation of "UBB code" The primary regular Expression object method: The Replace () method.
The Replace method syntax is as follows:
The Replace method syntax is as follows:
Describe
Replaces the text found in the regular expression lookup.
Grammar
Object. Replace (string1, string2)
The syntax for the Replace method consists of the following sections:
Partial description
Required for object. Always the name of a RegExp object.
String1 is required. String1 is the string that will be replaced with text.
String2 is required.
String2 is a replacement text string.
 
Description
The actual mode of the replaced text is set by the RegExp object's Pattern property.
The Replace method returns a copy of the string1, where the Regexp.pattern text has been replaced with string2. If no matching text is found, a copy of the original string1 is returned.
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.