I’ve got a string with a bunch of multi-letter codes in it and I’d like to parse it out according to those codes. I’m not sure how to make it look at more than one character to determine if it forms part of a code.
My string looks like this:
BBCTEEBOBBB
and I want to parse out these instances:
E BB CT BOB
So the result should be output (or an array) that looks like this:
BB CT E E BOB BB
I would use regular expressions. In Tools | References, add the highest version of the Microsoft VBScript Regular Expressions library available on your PC (5.5 on mine). Then you can use code such as the following:
The
myparserfunction generates aMatchCollectionobject which can be toured as in themainsubroutine. The output is a list, in order, of all of the matches found in the input string. You should be able to easily convert this to generate an array or space-delimited string.