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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

regular expressions find / replace 1

Status
Not open for further replies.

marc7

Programmer
Oct 4, 2001
35
0
0
US
i am creating a web page that takes a registration code, checks a text file to make sure the code exists and then allows the user to enter the site. my problem is that i would like to then erase the code from the text file. what is the best way to do this with asp? do i have to, after checking for the match, read the file to a stream, delete the code and then overwrite the existing file? any tips would be appreciated.
 
that majorly depends on the format of your file, but certainly what you described is one way to accomplish your goal.

-pete
 
thanks i am working on this and getting the following error

Microsoft VBScript compilation error '800a0414'

Cannot use parentheses when calling a Sub

/scripts/pcheck.asp, line 43

objRegExpr3.Replace(s1, password)

here is the matching part of the code. password is the access code variable and i created a string s1 that is the list of all the passwords. i want to search s1 for the password and delete it...

Dim fso3, ts3, s1
Set fso3 = CreateObject("Scripting.FileSystemObject")
Set ts3 = fso3.OpenTextFile("E:\InetPub\scripts\password_pairs2.txt", 8)
Dim objRegExpr3
Set objRegExpr3 = New regexp
objRegExpr3.Pattern = password
objRegExpr3.Global = True
s1 = strg
objRegExpr3.Replace(s1, password)
ts3.WriteLine s1
ts3.close


 
you have to set the replace to a variable
as
strg = objRegExpr3.Replace(s1, password)
or something to that effect.

otherwise it reads as a sub or function call _________________________________________________________
for the best results to your questions: FAQ333-2924
[sub]01001111 01101110 01110000 01101110 01110100[/sub]
onpnt2.gif
[sup] [/sub]
 
Cute signature onpnt, it inspired me to write a converter :)
-Tarwn [sup]01001101 01101101 01101101 00101110 00101110 00101110 01000011 01101111 01100110 01100110 01100101 01100101[/sup]
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
I thought you might like that one!

Thanks for the star [smile] _________________________________________________________
for the best results to your questions: FAQ333-2924
[sub]01001111 01101110 01110000 01101110 01110100[/sub]
onpnt2.gif
[sup] [/sub]
 
Wasn't me :)

heh, new toy:
[yoda] 01001000 01101001 01101010 01100001 01100011 01101011 00100000 01111001 01101111 01110101 01110010 00100000 01110100 01101000 01110010 01100101 01100001 01100100 00100000 01110111 01100101 00100000 01101000 01100001 01110110 01100101 00101110 00101110 00101110
[sup]01001101 01101101 01101101 00101110 00101110 00101110 01000011 01101111 01100110 01100110 01100101 01100101[/sup]
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
[pc3 010010010111001100100000011101000110100001101001011100110010000001111001011011110111010101110010001000000111001101100101011000110111001001100101011101000010000001100100011001010110001101101111011001000110010101110010001000000111001001101001011011100110011100111111 ________________________________________________________________________
Are you trying to debug your ASP applications? See faq333-3255 for more details

regards,
Brian
 
yeah, that way we don't get in trouble [lol] _________________________________________________________
for the best results to your questions: FAQ333-2924
[sub]01001111 01101110 01110000 01101110 01110100[/sub]
onpnt2.gif
[sup] [/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top