Last time, 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, and then,
Let's take a look at the other features of the regular Expression object. When we surf the internet, especially when browsing various forums, we often meet "UBB code"
The word. 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 country
Use this program) to adopt a special tag. In order to avoid the user unintentionally or intentionally the HTML code to the Forum attack, each kind of forum basically has blocked the HTM
L Code, but in order to make the forum more "colorful", the forum will be appropriate to open some of the custom tag tag, similar to the HTML tag, such as
[Url],[/url],[red],[/red], which provides some functionality that is equivalent to HTML code, and avoids malicious attacks on the forum, these custom
All kinds of tag is commonly known as UBB code. Today's trendy forums support UBB code, such as: http://www. Chinaasp. COM (move
Sense Technology Network) is a good forum to 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" to
It's like.
About common methods of regular expression objects, how to use them, and I am in this magazine "using the regular expression object to implement data validation in ASP"
After a detailed introduction, you can see that article, here, I mainly introduce the implementation of "UBB code" the main regular Expression object method: Replace () side
Method.
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, it returns
Copy of the original string1.
Next, we're going to make sure what kind of UBB code do we ultimately want to implement? This time we want to implement the UBB code features as follows:
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