Reputation: 131
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.
Is there a good regex library for VB6?
Upvotes: 7
Views: 3963
Reputation: 15217
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.
Upvotes: 2
Reputation: 405795
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.
Upvotes: 2
Reputation: 5585
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.
Upvotes: 2
Reputation: 10124
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
Upvotes: 4