RegExpr for VB & VBA

RegExpr box

RegExpr is a regular expressions module for Visual Basic 6.0 and VBA.

What's in it? RegExpr for VB & VBA is a source code module with support for a full range of regular expressions. Implemented as pure VB or VBA source code, it does not require any additional run-time libraries.

When do I need it? RegExpr lets you use regular expressions in Visual Basic 6.0 and Office VBA as if they were built in the language itself.

How do I use it? You simply include RegExpr.bas in your project and start writing calls like this:
If RegExpr(Text, "[A-Z]*") Then...

How do I learn it? See the Tutorial.

Can I just use VB's built-in Like and Replace? Sure you can—if you're happy with the features they support. Regular expressions are much more. They can search for all character combinations, allow "Or" rules, verify the number of character occurrences, and support zero-width concepts such as word boundaries, end-of-line and "not followed by".

What's so great about RegExpr? RegExpr for VB & VBA implements a full range of regular expressions in pure source code. It doesn't require any external libraries or run-times. No DLLs to distribute.

Supported expressions

RegExpr supports a wide range of regular expression types. Here is a short list. See syntax for a complete list.

x*Zero or more x's
x+One or more x's
x?One or zero x's
x{m,n}At least m and at most n x's
[A-Z]Any uppercase character A-Z
.Any single character except a newline
\wAny alphanumeric character
\dAny digit (the same as [0-9])
^Start of string (or line)

RegExpr also supports advanced syntax such as:

x*?Stingy or minimal matching
\1 .. \9Backreferences
(?=text)Positive lookaheads
(?!text)Negative lookaheads

Run the demo!

30-day
money back
guarantee

RegExpr for VB & VBA is available as a compiled demo EXE for Windows.
Download the demo

The real thing is an ordinary source code module. Pure VB and VBA.

System requirements

The free demo and help file are Windows-only. The Online Help has the same help content and is platform independent.

Latest update

RegExpr v1.2 supports numerous smaller improvements and fixes. Details of the regex engine have been documented accurately. See version history.

See also

RegExpr Online Help
Regular expressions - An introduction

We use RegExpr in our own applications as well.