Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't Create Instance of Object 1

Status
Not open for further replies.

scripter73

Programmer
Apr 18, 2001
421
US
Hi,

Would anybody know why I can't create an instance of an object utilizing the New operator? My ASP engine runs standard ASP code okay, but when I add the New keyword, it complains about the syntax. This is the weirdest thing. I've checked the syntax in books and on sites. Following is some code that I copied straight from a website just to test.

<html><head><title></title></head>
<body>
<%


Dim str ' some string that needs to have certain words
' replaced with other words
str = &quot;Apache Rules&quot;
Dim objRegExp
Set objRegExp = New RegExp SYNTAX COMPLAINT

objRegExp.IgnoreCase = True
objRegExp.Global = True

'Replace all instances of Apache with IIS
objRegExp.Pattern = &quot;\bApache\b&quot;
str = objRegExp.Replace(str, &quot;IIS&quot;)

'Repalce all instances of Perl with ASP
objRegExp.Pattern = &quot;\bPerl\b&quot;
str = objRegExp.Replace(str, &quot;ASP&quot;)

Set objRegExp = Nothing 'Clean up!

response.write str

%>

</body>
</html>



Thanks in advance,
scripter73
 
looks like vb code to me --

You should probably use a

set objRegExp = server.createObject(&quot;objectID&quot;)

Where object id is the parent library followed by a dot(.) and then the actual object --

such as

set rs = server.createobject(&quot;ADODB.Recordset&quot;)

I don't use regexp, so I don't know what needs to go in there, but that's where you're going wrong -- and you probably know what should go in there.

good luck! :)
Paul Prewett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top