Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using a RegExp object in Visual Basic

117 views
Skip to first unread message

Kerry Moorman

unread,
Aug 5, 1999, 3:00:00 AM8/5/99
to
An article on MSDN states:

"To maximize the usefulness of regular expressions, the VBScript regular
expression object is implemented as a COM object; any application that uses
COM can make use of the object. All you need to do is install VBScript
Version 5.0 and use the COM object with ProgID "VBScript.RegExp". Now, you
Visual Basic developers can use regular expressions in your Visual Basic
projects! "


I installed VBScript version 5 by downloading and running ste50en.exe. This
installed scrrun.dll, version 5. When I start a project in VB5, I can now
choose References from the Project menu and select Microsoft Scripting
Runtime. But the Object Browser does not show a RegExp object as part of
the Scripting library. It shows the FileSystemObject, TextStream, etc., but
not RegExp.

Is there a RegExp object as part of the version 5 Scripting library? Is it
part of some other download that I need? Can I use this RegExp object in VB,
as the article on MSDN suggests?

Any advice will be greatly appreciated!

Kerry Moorman

Vernon W. Hui (MS)

unread,
Aug 5, 1999, 3:00:00 AM8/5/99
to
Hi Kerry,

You have the right idea, but Regular Expressions is not contained the
Microsoft Scripting Runtime reference. You need to look for the "Microsoft
VBScript Regular Expressions" reference. Once you get that, you should be
all set.

Thanks
Vern
--
Vernon W. Hui
Microsoft Scripting Technologies
Software Test Engineer
http://msdn.microsoft.com/scripting


Kerry Moorman <kmoo...@wku.campuscwix.net> wrote in message
news:e3Oc8z13#GA.250@cppssbbsa03...

Kerry Moorman

unread,
Aug 5, 1999, 3:00:00 AM8/5/99
to
Vern,

After running ste50en.exe to install the scripting files, I don't have
anything resembling the reference "Microsoft
VBScript Regular Expressions". My VB5 references for anything resembling
scripting stuff are Microsoft Scripting Runtime and Microsoft Scriptlet
Library. Neither has the RegExp object.

If I use Explorer to view the dll files added to my system from the
installation process, I can add references to vbsript.dll and jscript.dll.
But these result in references to Microsoft VBScript Global and JSGlobal.
JSGlobal contains a RegExpObj object, but I don't believe that is what I
need.

Do I need to download some file other than ste50en.exe to install the RegExp
object? I don't see anything else that looks like what I need on MS's site.

Thanks for your response. Any advice will be appreciated,

Kerry

Vernon W. Hui (MS) wrote in message ...

Michael Harris

unread,
Aug 5, 1999, 3:00:00 AM8/5/99
to
For some reason, the Microsoft VBScript Regular Expressions doesn't show up in
the VB Reference dialog's Available References list on all boxes with VBScript
version 5.0 installed. For instance, it doesn't for VB5Pro on my Win98 box or
for VB5EE on my WinNT box.

Here's a hack: add the following line manually to the .vbp file using a simple
text editor.

Reference=*\G{3F4DACA7-160D-11D2-A8E9-00104B365C9F}#0.0#0#..\..\WINDOWS\SYSTEM\v
bscript.dll\2#Microsoft VBScript Regular Expressions

This is going to line wrap in this post, so make sure to unwrap it to a single
line. The path here is for a Win98 box. You'll need to change it accordingly
for a WinNT box.

--
Michael Harris

Kerry Moorman <kmoo...@wku.campus.mci.net> wrote in message
news:O1TcoL53#GA.242@cppssbbsa05...

Kerry Moorman

unread,
Aug 6, 1999, 3:00:00 AM8/6/99
to
Michael,

Thanks! That work-around seems to work with my VB5Pro on Win95.

But what a sad commentary on Microsoft's products to have to go to this
length to use a COM object in VB! Its this kind of nonsense that gives MS a
well-deserved bad name in much of the development community.

Thanks again,

Kerry

Michael Harris wrote in message ...

Vernon W. Hui (MS)

unread,
Aug 6, 1999, 3:00:00 AM8/6/99
to
Hey guys,

I agree that this is a terrible bug. Thanks for pointing this to me late
last night Michael. Indeed this is a known issue that VB5.0 has a bug in
which it doesn't pull up the second type libraries on an object correctly.

However, all is not lost, a VB5.0 user can still use the RegExp object, but
needs to use CreateObject().
So, you can still use the RegExp object by:
set re = Createobject("VBScript.RegExp")

It's fixed in VB6.0, btw.

Thanks
Vern
--
Vernon W. Hui
Microsoft Scripting Technologies
Software Test Engineer
http://msdn.microsoft.com/scripting

Kerry Moorman <kmoo...@wku.campuscwix.net> wrote in message
news:Ou2XyBB4#GA....@cppssbbsa02.microsoft.com...

behind...@my-deja.com

unread,
Aug 20, 1999, 3:00:00 AM8/20/99
to
Vernon, Andrew, and others:

Thanks for the info re this bug. It's enabled me to move forward.

I don't suppose there's much hope for a fix or workaround to allow
RegExp to be fully registered/seen by IntelliSense in the Office
97 /VBA 5 environment? It's going to be awhile before my company
upgrades.

Thanks in advance from the second (third?, fourth?) tier. ;-)

P.S. I'm ECSTATIC at having regex support. Thanks!


In article <#XXKpSE4#GA....@cppssbbsa02.microsoft.com>,


"Vernon W. Hui \(MS\)" <ver...@microsoft.com> wrote:
> Hey guys,
>
> I agree that this is a terrible bug. Thanks for pointing this to me
late
> last night Michael. Indeed this is a known issue that VB5.0 has a bug
in
> which it doesn't pull up the second type libraries on an object
correctly.
>
> However, all is not lost, a VB5.0 user can still use the RegExp
object, but
> needs to use CreateObject().
> So, you can still use the RegExp object by:
> set re = Createobject("VBScript.RegExp")
>
> It's fixed in VB6.0, btw.
>
> Thanks
> Vern
> --
> Vernon W. Hui
> Microsoft Scripting Technologies
> Software Test Engineer
> http://msdn.microsoft.com/scripting


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

0 new messages