RegExpr for VB & VBA

RegExpr adds regular expressions to Visual Basic 5.0, 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 5.0, 6.0 and Office VBA as if they were built in the language itself.

How do I learn it? See the Introduction and TutorialPopup link.

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.

What are the system requirements?

  • VB: Visual Basic 5.0 and 6.0. Windows only.
  • VBA: Word 97 and later, Excel 97 and later, Access 2000 and later. Platform independent solution runs on Office for Windows and Mac.
RegExpr
Regular expressions are a pattern matching standard, somewhat similar to VB's Like statement. In many programming languages regular expressions are a built-in feature. RegExpr you add this power to Visual Basic. Validate user input, search for patterns, parse text, replace strings etc.

What can you do with regular expressions? Examples:

  • check if an email address is correctly formed
  • parse dates, social security numbers and the like
  • extract the 3rd word of a sentence
  • find repeated words in a piece of of text
  • read;in;semicolon;separated;input
  • find all dollar amounts in a string

Supported expressions

RegExpr supports a wide range of regular expression types. Here is a short list. The help file has a complete list with instructions.
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])

Advanced syntax

If you already know regexes, you might be interested in knowing that RegExpr supports almost all possible regexes, such as:
x*?Stingy or minimal matching
$1 $2 ...Subexpressions or remembered patterns
\1 \2 ...Backreferences
(?=text)Positive lookaheads
(?!text)Negative lookaheads

Run the demo!

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.

Windows & Mac

Windows. RegExpr is compatible with all versions of Windows.

Mac. RegExpr is compatible with Office for Mac. The demo and help file are Windows-only. Use the Online HelpPopup link for reference.

See also

RegExpr Online HelpPopup link
Regular expressions - An introduction

RegExpr is being used in several commercial applications, including Project Analyzer and Visustin.

©Aivosto Oy -