4 VBA/Access vs. Perl/Awk/Python/MySQL

The pattern matching ability of VBA is not bad, but it is not very flexible, either. Programming languages inspired by awk and sed, such as PHP and Perl, provide far more flexible pattern matching mechanisms. Similarly, the SQL (structured query language) of Access is also more restrictive than other SQL implementations like MySQL and PostgreSQL.

Perhaps the worst part is that the Access/VBA pattern matching standard is incompatible with that of other languages and SQL implementations. Specifically, the use of the asterisk (*) and question mark (?) in Access/VBA is inconsistent with the use of the same symbols in other languages and SQL implementations.

It is not difficult to illustrate the limitations of VBA’s pattern matching ability. Let us consider matching a name that starts with a upper case letter, followed by at least one lower-case letter. This cannot be expressed in VBA patterns because there is no way to specify “any number of lower case letters”.

However, this pattern is trivial to express in other languages.

Those who want to learn more about pattern matching should look up the phrase “regular expression” (often abbreviated to regex or regexp). Many modern scripting languages like Perl, PHP and Pyphon, as well as most standard SQL implementations like MySQL and PostgreSQL support it.