Using Regular Expressions (RegExp) in Excel

Ease of Use


Version tested with


Submitted by:



Scenarios and code using RegExp, a powerful parsing tool. 


The attached file provides seven examples that cover the RegExp Execute, Replace and Test Methods. The examples also show how to create and access submatches and backreferences. The scenarios below are contained in the example file. 1. Extracting the numeric portion of a string. 2. Reversing the order of a persons name. 3. Testing the validity of an email address (assuming simple constraints) and then parsing it. 4. Testing whether the first three characters at the start of a string are found at the end of a string in reverse order. 5. Converting the nth cell reference in a range of Excel Formulae from relative to absolute reference. 6. Testing the validity of a required numeric string input. 7. Removing duplicated alphanumeric strings. 


instructions for use


All code Is contained In the file attachment.

How to use:

  1. Open the file, select an example from the hyperlinked menu page and then press the command button to run that example.

Test the code:


Sample File:

RegExp Sept 1 2004.zip 81.02KB 

Approved by mdmackillop

This entry has been viewed 2508 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2014 VBA Express