One of the most powerful features of some other languages is their ability to utilize Regular Expressions for finding patterns… Sadly however, vba does not have the ability to use them, well at least not naitively! Suprisingly enough, it really is not very complicated to be able to integrate RegEx with one of your procedure by simply creating a vbscript object. The basic idea goes something like:
Set oRegEx = CreateObject("vbscript.regexp") oRegEx.Pattern = "YourRegEx Goes Here" bResult = oRegEx.Test(YourStringToTestTheRegExWith) |
A great source of RegEx for various purposes can be found at http://regexlib.com/ (click on the button ‘Browse Expressions’). Start by looking there before wasting your time trying to reinvent the RegEx wheel. You’re not the first to need to validate a string, number, …, chances are a RegEx exists that you can simply copy.
And there you go, now you can integrate the power of Regular Expressions in all of your Databases, Spreadsheets, Documents and more! Simple as can be!!!
Current average ratings.

Tuesday, June 22nd, 2010, 9:59 pm | 

