Sometimes we need to replace the dynamic pages in the page with our pseudo-static format, usually batch replacement in the page content
This is a program that replaces dynamic URLs with static URLs:
Copy the code code as follows:
<%
Function RegUrl(TheStr)
Set RegEx = New RegExp
RegEx.IgnoreCase=True
regEx.Global = True '****If you add this sentence, all will be replaced. If you don't add it, only the first one will be replaced.
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 URL</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
QualifierIISBOY.COM,IISBOY.COM
The following table gives an explanation of the various qualifiers and their meaning: Content from
Character description
* Matches the preceding subexpression zero or more times. For example, zo* matches "z" and "zoo". * Equivalent to {0,}.
+ Matches the preceding subexpression one or more times. For example, 'zo+' matches "zo" and "zoo", but not "z". + equivalent copyright
At {1,}.
? Matches the preceding subexpression zero or one time. For example, "do(es)?" matches "do" or "do" in "does". ? Equivalent to copyright
{0,1}.
{n} n is a nonnegative integer. Match determined n times. For example, 'o{2}' does not match the 'o' in "Bob", but it does
The two o's in "food".
{n,} n is a non-negative integer. Match at least n times. For example, 'o{2,}' does not match the 'o' in "Bob", but it does
All the o's in "foooood". 'o{1,}' is equivalent to 'o+'. 'o{0,}' is equivalent to 'o*'.
{n,m} m and n are both non-negative integers, where n <= m. Match at least n times and at most m times. For example, "o{1,3}" will match copyright
The first three o's in "fooooood". 'o{0,1}' is equivalent to 'o?'. Please note that there cannot be a space between the comma and the two numbers.
locator
The following table contains a list of regular expressions and their meanings:
Character description
^ matches the beginning of the input string. If the Multiline property of the RegExp object is set, ^ also matches '/n' or '/r'
position after that.
$ matches the end of the input string. If the Multiline property of the RegExp object is set, $ also matches either '/n' or '/r'
front position.
/b matches a word boundary, which is the position between a word and a space.
iisboy original