ljb
2006-04-07 15:45:09 UTC
I using the following to create hyperlinks of every 7 digit number in an
html table. The problem is there are some duplicate numbers and they create
href's within href's. How do I get rid of the duplicates in a matches
collection before I use vbscript's replace function? I first thought of
using regular expression's replace method and sub-matches but wasn't
successful. The desired result is given 1234567 create
href="./7/1234567.shtml"
sub MakeHyperlinks(strTable)
dim match, regEx
set regEx = Server.CreateObject("VBScript.RegExp")
regEx.Global = True
regEx.Pattern = "\d{7}"
for each match in regEx.Execute(strTable)
strTable = Replace( _
strTable, _
match, _
"<a href=""./" & right(match,1) & "/" & match & ".shtml"">" & match &
"</a>")
next
set regEx = nothing
end sub
thanks
LJB
html table. The problem is there are some duplicate numbers and they create
href's within href's. How do I get rid of the duplicates in a matches
collection before I use vbscript's replace function? I first thought of
using regular expression's replace method and sub-matches but wasn't
successful. The desired result is given 1234567 create
href="./7/1234567.shtml"
sub MakeHyperlinks(strTable)
dim match, regEx
set regEx = Server.CreateObject("VBScript.RegExp")
regEx.Global = True
regEx.Pattern = "\d{7}"
for each match in regEx.Execute(strTable)
strTable = Replace( _
strTable, _
match, _
"<a href=""./" & right(match,1) & "/" & match & ".shtml"">" & match &
"</a>")
next
set regEx = nothing
end sub
thanks
LJB