ASP regular replacement links to achieve pseudo static effect _ application techniques

Source: Internet
Author: User

This is a program that replaces dynamic URLs into static URLs:

Copy Code code as follows:

<%
Function Regurl (THESTR)
Set RegEx = New RegExp
Regex.ignorecase =true
Regex.global = True ' * * * * This sentence plus is all replace, if not add, only replace the first
Regex.pattern = "pic_list_mb\.asp\?id= (\d*) \&page= (\d*)"
Regurl=regex.replace (Thestr, "pic_list_$1_$2.html")
End Function
content= "<ul><li><a href=pic_list_mb.asp?id=1&page=2> dynamic website </a></li><li> <a href=pic_list_mb.asp?id=32&page=1> dynamic URL 1</a></li</ul> "
Content=regurl (content)
Response.Write Content
%>

The generated static URL is: pic_list_1_2.html pic_list_32_1.html

Qualifier Iisboy NET, iisboy.com
The following table gives a description of the various qualifiers and their meanings: content from www.iisboy.com
Character description
* Match the preceding subexpression 0 or more times. For example, zo* can match "z" and "Zoo". * is equivalent to {0,}.
+ matches the preceding subexpression one or more times. For example, ' zo+ ' can match "Zo" and "Zoo", but cannot match "Z". + Equivalent Copyright www.iisboy.com
to {1,}.
? Match the preceding subexpression 0 times or once. For example, "Do (es)" can match "do" in "do" or "does". Equivalent to the copyright www.iisboy.com
{0,1}.
{n} n is a non-negative integer. Matches the determined n times. For example, ' o{2} ' cannot match ' o ' in ' Bob ', but can match
Two o in "food".
{N,} n is a non-negative integer. Match at least n times. For example, ' o{2,} ' cannot match ' o ' in ' Bob ', but can match
All o in "Foooood". ' O{1,} ' is equivalent to ' o+ '. ' O{0,} ' is equivalent to ' o* '.
{n,m} m and n are non-negative integers, where n <= m. Matches n times at least and matches up to M times. For example, "o{1,3}" will match the copyright www.iisboy.com
The first three o in "Fooooood". ' o{0,1} ' is equivalent to ' o '. Notice that there is no space between the comma and the two number.

Locator character www.iisboy.com
The following table contains a list of regular expressions and their meanings:
Character description
^ matches the start position of the input string. If the Multiline property of the RegExp object is set, ^ also matches ' \ n ' or ' \ R '
After the position.
$ matches the end position of the input string. If the Multiline property of the RegExp object is set, $ also matches the ' \ n ' or ' \ R '
Before the position.
\b Matches a word boundary, which refers to the position between the word and the space.

Iisboy Original

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.