Forum Moderators: open
what about if you do a split() on the whole page and use "<%" as delimiter. then loop through the array and split each entry with the delimiter "%>". not you'll get an array of n entries. if n > 1 then the first element of the current array is an asp tag. all you've got to do now is to collect each entry of the current array in to a new one. this array is all you wanted after the loop.
this is written in code what i described. this is not speed optimzed (see the redim()), but does its work. check for syntax first, i did not run it.
dim t as string, v as variant, w as variant
dim a1() as string, a2() as string, a3() as string
dim c as long
t = (string with the whole file content)
a1 = split(t,"<%")
for each v in a1
a2 = split(cstr(v),"%>")
if ubound(a2) > 0 then
a2(0) = "<%" + a2(0) + "%>"
end if
for each w in a2
redim a3(0 to c)
a3(c) = cstr(w)
c = c +1
next
next
Below is an example of how a regular expression to match fonts would look?
Dim rex as regex = new regex("<font.*?>(?<FontStuff>.*?)</font>")
Then you loop through the 'Group' captures that are labeled FontStuff.