This might work for you. I don't really have all the info from you that I
would need, but assuming that there
is a file "url.txt" that is formated like this:

http://www.feathertrip.net/cgi-bin/index.cgi?client=23894749&;
http://www.feathertrip.net/cgi-bin/index.cgi?client=23894749&;
http://www.feathertrip.net/cgi-bin/index.cgi?client=23894749&;
http://www.feathertrip.net/cgi-bin/index.cgi?client=23894749&;
http://www.feathertrip.net/cgi-bin/index.cgi?client=23894749&;


Yada yada yada.... The below code should work for you:

#!/usr/bin/perl -w


$file = "./url.txt";


open FILE, "$file"      or die "Cannot open file $file: $!\n";


    while(<FILE>) {
        s/^(.*)\?(client\=\d{8}\&)$/$1/;
        print "$1\n";
    }
close(FILE);


Lemme know if you have anyother questions.
Also try looking at this:

perldoc -q regular

-James

-----Original Message-----
From: rory oconnor [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 10:31 AM
To: perl
Subject: regex question


I am using LWP to hit a page and save the source to a file.  But before
it saves it I want it to strip out the client id from the urls.  They
are always in the same format:

client=xxxxxxxx&  # 8 digits and then ampersand

so what I want to strip out is stuff like:

client=23894749&

i am a newbie so regex is a little out of my league.  any help
appreciated!

thanks,

Rory




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to