RegExp Replace Method causes Access Violation

A

Alex

Hi group,

I am using the VBScript RegExp object from an ASP-Page and
I got
the following debugger output, when calling the Replace()
method:

"First-chance exception at 0x77e97c5c in inetinfo.exe:
0xC0000005: Access
violation reading location 0x0000400c."

Otherwise the code is running fine. The result is correct
too.
But is it normal to have this exeption???
Or is there a bug in den VB component?!

Here is the code:

<%
Set objRegExp = New RegExp
strReplace= ""
strPattern = "[^\s\w]"
objRegExp.IgnoreCase = TRUE
objRegExp.Global = TRUE
strToReplace = "this-is-a-test."
objRegExp.Pattern = strPattern
strResult = objRegExp.Replace(strToReplace, strReplace)
Response.Write(strResult)
%>

Here are some system informations:

W2K (5.00.2195 Service Pack 3)
Internet Information Server 5
vbscript.dll (Version 5.6.0.7426)

Thanks,
Alex
 
S

Steven Burn

"strReplace= "" "

^^Your replacing nothing

Assuming the ASP replace function is the same as the VB one, it should be;

strResult = Replace(Expression, strToReplace, strReplace)

Where expression is the string itself. E.g. if you wanted to replace

"I went to the park today"

With

"I went to the park yesterday"

It would be

strResult = Replace("I went to the park today", "today", "yesterday")

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
C

Chris Hohmann

Steven Burn said:
"strReplace= "" "

^^Your replacing nothing

Assuming the ASP replace function is the same as the VB one, it should be;

strResult = Replace(Expression, strToReplace, strReplace)

Where expression is the string itself. E.g. if you wanted to replace

"I went to the park today"

With

"I went to the park yesterday"

It would be

strResult = Replace("I went to the park today", "today", "yesterday")

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
news:[email protected]...

You are wrong, but that's for participating. ;-p
The OP is using the Replace method of the RegExp object, not the
VBScript Replace function.

HTH
-Chris Hohmann
 
S

Steven Burn

hehe, after the day I am having, I kinda figured I would be (had an
extremely bad fortnight cause of my cr_ppy ISP and doesn't look like it's
gonna get better any time soon)

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
C

Chris Hohmann

Alex said:
Hi group,

I am using the VBScript RegExp object from an ASP-Page and
I got
the following debugger output, when calling the Replace()
method:

"First-chance exception at 0x77e97c5c in inetinfo.exe:
0xC0000005: Access
violation reading location 0x0000400c."

Otherwise the code is running fine. The result is correct
too.
But is it normal to have this exeption???
Or is there a bug in den VB component?!

Most likely component related. Here's a link:

www.aspfaq.com/2355

HTH
-Chris Hohmann
 
M

MSFT

Hi Alex,

I also can't reproduce the problem yet. From the error, it seems to be a
install or configration issue, for example, corrupted installtion for
RegExp. You may try to execute a VBS file with similar code on the computer
to confirm this.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
A

Alex

Thanks all for the participation!
I solved the problem in installing the newest vbscript.dll
(version 5.6.0.8515)

Alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top