G
Guoqi Zheng
Dear Sir, I need to use regex to replace some string.
Below is what I use.
output = "sample data <href=""xlink:GG44-33"">, part two
<href=""xlink:GG55-123"">"
Dim regEx
Set regEx = New RegExp
regEx.Pattern = "href=\""(xlink:.*?)\"""
output = regEx.Replace(output,"href="&chr(34) &
GetDatabaseLink("$1")&chr(34))
Function GetDatabaseLink(Byval input)
'' query database based on "input" value and return value on database.
End Function
the value inside <href> tag needs to be replaced by real value from
database. Function GetDatabaseLink get the value from match string and send
it to database for query. What the database receive right now is the value
of "$1", instead of "xlink:GG44-33" and "xlink:GG55-123" in this case.
What did I do wrong?
Regards,
Guoqi Zheng
Below is what I use.
output = "sample data <href=""xlink:GG44-33"">, part two
<href=""xlink:GG55-123"">"
Dim regEx
Set regEx = New RegExp
regEx.Pattern = "href=\""(xlink:.*?)\"""
output = regEx.Replace(output,"href="&chr(34) &
GetDatabaseLink("$1")&chr(34))
Function GetDatabaseLink(Byval input)
'' query database based on "input" value and return value on database.
End Function
the value inside <href> tag needs to be replaced by real value from
database. Function GetDatabaseLink get the value from match string and send
it to database for query. What the database receive right now is the value
of "$1", instead of "xlink:GG44-33" and "xlink:GG55-123" in this case.
What did I do wrong?
Regards,
Guoqi Zheng