Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 2nd, 2006, 10:48 AM
Authorized User
 
Join Date: Jul 2006
Location: , , .
Posts: 21
Thanks: 0
Thanked 1 Time in 1 Post
Default RegExp Problem

Hello,

I am having a little problem with my function to encrypt the query strings....

Code:
Function encryptMenu(HTMLstring)

    Dim objRegExp : Set objRegExp = New RegExp
    Dim expressionMatch, expressionMatched, strTemp

    With objRegExp
        .Pattern = "(\?)[(\w\.\&*)+(\=)[\w\d ]*"
        .IgnoreCase = True
        .Global = True
    End With

    Set expressionMatch = objRegExp.Execute(HTMLstring)

    If expressionMatch.Count > 0 Then
        For Each expressionMatched in expressionMatch

            strTemp = Right(expressionMatched.value, (Len(expressionMatched.value)-1))
            'Alert strTemp
            HTMLString = Replace(HTMLString, strTemp, EncryptQS(QSCleanup(strTemp), Salt()))

        Next
        'Alert HTMLString
    encryptMenu = HTMLString

    Else
        'Response.Write "<B>" & objRegExp.Pattern & "</B> was not found in the string: <B>" & StringToSearch & "</B>."
    End If

    Set objRegExp = Nothing
    Set expressionMatch = Nothing

End Function

' Perform the necessary cleanup to the QueryString.
Function QSCleanup(QS)
    QSCleanup = Replace(QS, "&amp;", "&")
End Function
Now, I correctly pick out the query string (everything after the "?"), and for most entries it works fine....However, I have a couple of them that even though I pick out the query string, it doesnt replace the whole thing...for example:

noretrieve=true&rptid=jax212&dbcode=2&leasepro_id= 1000018528&udb_id=100001.8528&usertype=V

becomes...

noretrieve=true&rptid=jax212&ENC_QfsJ/OaMUZ1cHMjPnUEM4o8C2+tdI/173ET767CvDXE4CEHmTyc5eWNTwinaV+/lI0K5idTSH32yKg+myuvdjA==

it should just be ...

ENC_QfsJ/OaMUZ1cHMjPnUEM4o8C2+tdI/173ET767CvDXE4CEHmTyc5eWNTwinaV+/lI0K5idTSH32yKg+myuvdjA==

Anybody have an idea as to why this is happening?

Thanks!



Similar Threads
Thread Thread Starter Forum Replies Last Post
RegExp crmpicco Javascript How-To 0 July 7th, 2005 05:59 AM
RegExp crmpicco Classic ASP Basics 0 June 6th, 2005 05:54 AM
RegExp Nitin_sharma Javascript 2 November 30th, 2004 07:21 AM
regexp problem godhsf80 Javascript How-To 5 March 11th, 2004 04:38 AM
regexp problem godhsf80 PHP How-To 2 March 10th, 2004 04:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.