views:

322

answers:

2

Okay, this is the problem:

I am getting this error message when I am trying to run the following script

Dim rg
Dim match

Set rg = New RegExp

rg.Pattern = "Mod Read Access"
rg.Global = True

roles = Session("Roles")
Set match = rg.Test(roles)

it chokes at the rg.Test(roles) point.

I suspect that I may be doing something wrong since I don't normally program in asp classic. What exactly am I doing wrong?

A: 

The RegularExpressionObject could not be found, that is the error code your receive. Also regular expressions with cscript of vbscript will result in memory leaks.

pipelinecache
+5  A: 

Instead of:

Set match = rg.Test(roles)

try:

match = rg.Test(roles)

Set is used for object assignment. The Test method returns a Boolean not an object, hence calling it with Set fails (runtime error 800a01a8 is "Object required").

Simon Forrest
That was it. Thanks! :)
Hugo Estrada
+1: got in there about a second before I did ;) Oh, and for what its worth, regex is overkill, use InStr function instead: http://www.w3schools.com/Vbscript/func_instr.asp
Juliet
Thanks for the comment, Juliet. I will keep InStr in mind for the next similar situation.
Hugo Estrada