July 7, 2001

Count number of words with the RegExp object

A Visual Basic function that counts the number of words in a sentence or text file can become quickly very complex, and usually doesn’t execute fast enough for most purposes.

Extract words with the RegExp object

The following routine extracts all the words from a source string and returns a collection. Optionally, the result contains only unique words.This code is remarkably simpler than an equivalent “pure”