regular expression in VBScript
Posted on 2002-03-04
I have a string with some links in there
for example: str1 = " this is link1, link2 and link3"
I can use regular expression to find the links then make the Matches Object. Then use
For Each strMatch In strMatches
'with strMatch.Value and strMatch.Index
'to replace link1 to alink1, link2 to alink2,
'and link3 to alink3.
The problem is if link1=link2 then at the end I will have aalink1, aalink2, and alink3. (notice double a's)
That is because, the first replace replaces link1 to alink1, then the second replace (for link2) will replace link1 in alink1 to alink1 -> then result is aalink1.
Does anyone know how to fix that problem?
Thanks in advance.