Using ASP to realize the UBB function of forum (i.)

Source: Internet
Author: User
Tags comparison expression implement numeric numeric value regular expression
A few days ago I read a technical article about how to use regular expression objects in VBScript to implement the UBB functionality in a forum. VBScript provides a very powerful regular expression object, but only 5. More than 5 of the scripting engines can support regular expression objects well, in order to get a version that is
5. 5 script engine, you need to install the script engine alone, or install IE5.5, that is, the requirements of the server is more stringent, then there is no other way to implement the UBB function? Of course not, now follow me to use the common VBScript scripting language to achieve powerful UBB functions.
First, in the UBB function, the core function is the most attractive function is to fully support the texture and font properties of the control. Because for security reasons, almost all the forums above the network to screen out the HTML code as much as possible, so as to avoid man-made unintentional damage to the forum, so that although the security of the Forum itself, but users face the content of the posts is always the same color, font, size, Do not expect to see colorful pictures. Ubb code is born from this, specifically how we achieve the above UBB core functions.
Let's start with a detailed description of the syntax of the UBB code we're going to implement:
UBB syntax for supporting textures
Grammar:
Instance:
Description: The result of the above grammar is to display a picture on the page
Second, support the font color UBB syntax:
Syntax: [red] text [/red]
[Green] text [/green]
Wait a minute
instance: [Blue] This is a piece of blue text [/blue]
Description: A section of the above syntax is to display a blue color text
Third, UBB code to support hyper-connection
Syntax: http://www.alixixi.com/program/a/connection Address
Example: Http://www.coolbel.com/chinagusu
Description: The result of the above syntax is to generate a super connection, which will jump to the connecting address when you click!
Iv. UBB syntax to support email address
Grammar: Your email address
Example: Uestc95@263.net
Description: The above code result is to display an email address, when you click with the mouse, will automatically open the software to send e-mail, and will
Address written on.
V. UBB syntax to support font properties
Grammar: A piece of textWait a minute
Instance: a piece of bold text
Description: The result of the above code is to display a bold text
Well, the core function of UBB code is these things, and of course you can add other functions because the syntax of the UBB code is
To customize.
Before we begin to implement the UBB function specifically, let's take a look at several important VBScript functions: The InStr function and the Replace function. Maybe you see this
Can not help but want to say, this is too simple, oh, in fact, these two functions are indeed we use in programming more frequent two functions, but it also has its own little secret Oh, we first look at the specific syntax of these two functions:
InStr function
Returns the position of the first occurrence of a string in another string.
INSTR ([Start,]string1, string2[, compare])
Parameters
Start
Options available. A numeric expression that sets the starting position for each search. If omitted, the search begins at the position of the first character. If start contains Null, an error occurs. If you have specified compare, you must have the start argument.
String1
Required option. The string expression that accepts the search.
string2
Required option. The string expression to search for.
Compare
Options available. Indicates the numeric value of the comparison type to use when calculating the substring. For numeric values, see the "Settings" section. If omitted, the binary ratio is executed
More.
Set up
The Compare parameter can have the following values:
Constant
Value
Describe
Vbbinarycompare
0
Performs a binary comparison.
vbTextCompare
1
Performs a text comparison.
return value
The INSTR function returns the following values:
If
INSTR return
String1 is zero length
0
String1 is Null
Null
string2 is zero length
Start
String2 is Null
Null
String2 didn't find it.
0
Find string2 in string1.
Find the location of the matching string
Start > Len (string2)
0



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.