>
>
>client=xxxxxxxx&  # 8 digits and then ampersand
>
>so what I want to strip out is stuff like:
>
>client=23894749&
>
You want something like:

$url =~ s/client=\d\d\d\d\d\d\d\d&//;

or if you don't want to count those \d's

$url =~ s/client=\d{8}&//;

And since cilent=XXXXXXXX& probably can probably occur anywhere in the 
string, you might want to use match all cases:

$url =~ s/client=\d{8}&//;
# changes 
http://foo.bar.com/page?stuff=value&client=12345678&morestuff=differentvalue
# to http://foo.bar.com/page?stuff=value&morestuff=differentvalue

$url =~ s/&client=\d{8}//;
# changes 
http://foo.bar.com/page?stuff=value&morestuff=differntvalue&client=12345678
# to http://foo.bar.com/page?stuff=value&morestuff=differentvalue

$url =~ s/\?client=\d{8}$//;
# changes http://foo.bar.com/page?client=\d{8}
# to http://foo.bar.com/page


Notice the '?' and the '$' in the last one.  The '$' matches the end of 
the string.  The '?' is a special character that means 0 or 1 of the 
previous.  Since we want to simply match a literal '?' we need to escape 
it by using a backslash: '\?'.  If you really wanted to you can escape 
all the non-alphanumeric characters.  Its hard to remember what needs 
escaped and what doesn't.


You can roll all of these together by using:

$url =~ s/(client=\d{8}&|&client=\d{8}|\?client=\d{8}$)//;

- Johnathan


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

Reply via email to