Regular Expressions

Increasing Performance of Regular Expressions in VBA

In a previous post I presented some general-purpose wrappers for adding regular expressions functionality to VBA and SQL in Microsoft Access.

These wrappers work well, but we can make them much more efficient for situations where the same pattern is used many times, such as in a SQL query where the regular expression will be executed on each row of the input table or query. This article describes how to use a simple factory pattern to cache and reuse RegExp objects, dramatically increasing performance when the same pattern is used more than once during the lifetime of a program.

Read more


Regular Expressions in VBA

A frequent question for most database platforms is how to use regular expressions in SQL queries. Regular expressions are an awesome tool for working with text and are built in to just about every widely used programming language, but are not standardized in SQL. Sometimes relational databases are employed to work on chunks of text and having regular expressions available is mighty helpful. In this article I'll show how to build regex functions callable from both VBA and within MS Access SQL queries, using the VBScript Regular Expressions library. Also see Increasing Performance of Regular Expressions in VBA for how to turbo-charge the performance of these utility functions.

Read more