Ja7on
Ja7on

Reputation: 131

Regex library for VB6

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

Answers (4)

Michael Kropat
Michael Kropat

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:

screenshot

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

Bill the Lizard
Bill the Lizard

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

robsoft
robsoft

Reputation: 5585

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.

Upvotes: 2

t3rse
t3rse

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

Related Questions