I need to write a program that can sift through specially-formatted text files (essentially CSV files with a fixed set of column types that have different delimiters for some columns ... comma in most places, colons in others) to search for formatting errors. I figure regular expressions will be the way to go.
The question: Is there a good regex library for VB6?
Thank you!
Edit: Holy crap, 3 responses in under an hour. Thanks a ton, folks! I've heard such good things about Regex Buddy from Jeff's postings / podcasting, that I will have to take a look.
Use the Regex COM component built into Windows. You can find a step by step on referencing and using it in your project at: http://www.regular-expressions.info/vb.html
Regex Buddy has a VB6 library
I use this in Delphi and it's very good - and Jeff has raved about RegexBuddy on several occasions.
I can't speak for the VB implementation, but it's certainly worth a look.
As you probably know, VB6 didn't ship with a built-in regular expression library. You can, however, use one provided by an ActiveX or COM library. See this article for details.
Other answers are correct, but link-only answers, so for convenience:
In File → References, add the "Microsoft VBScript Regular Expressions 5.5" library:
Now you can use the library in your code:
Dim matcher As RegExp
Set matcher = New RegExp
matcher.Pattern = "^super cool string$"
If matcher.Test(someString) Then
'...do something...
End If
As usual, regular-expressions.info provides the best reference material.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With