Of course, there has to be a better way. Actually, there are many better ways. The real question is: Is there a worse way?
The count variables really make say WTF. It looks like the programmer ran out of space on one line and figured they had to define a new variable for the next line.
For me, this gives a completely new meaning to obfuscated code. There's elegant code, which is just the right density. Then there's code so compressed as to be confusing. Now, there's code that appears to be far too diluted. This could be more evidence of being paid based on the number of lines of code.
I like the optimism of including the two count variables in the aggregation lines. He's just gone to the trouble to set count = 0 but he optimistically includes it in the following line "count = count + test1 (et al)" in the hopes that maybe it's acquired a value magically.
People's fear of regex is unwarranted.
Okay, I admit that back when I first saw them I was a little freaked out.
But the first time I needed to use them, I read the syntax guide for 10 minutes and went 'oh. ok. this is cool.'
Sure, it might take longer to sit there and code that one line, but damned if its not quicker than writing all that garbage above.
Regexes are only frightening because they were designed by the same kind of people who find the obfuscated C contest clear and an example of good coding styles. Perl's myriad extensions didn't help that at all.
Perl 6 will have completely overhauled and entirely new regex syntax, with almost no relationship to the current. It's actually understandable, if a bit more verbose, and I look forward to using it in the future. It should cut down on the quantity of regexes from hell out there.
Of course, this is besides the point in VB/ASP, with its dirt-simple like regexes. There isn't much excuse for manual string searching anymore, even performance.