Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Parsing URL using regular expression

by Sec (Scribe)
on Jul 20, 2005 at 15:24 UTC ( #476525=note: print w/ replies, xml ) Need Help??


in reply to Parsing URL using regular expression

I suspect your mistake lies somewhere else. The above mentioned snipped works as expected and keeps the URL parameters:

#!perl -l $message_body="http://www.foo.com/bar.pl?aid=3D2744&bid=3D&cn=3DOM= Ddemo2&rid=3D0"; $message_body =~ s/=([0-9A-Fa-f]{2})/chr(hex($1))/ge; $message_body =~ s/=\n//g; $message_body =~ s/=3D/=/g; $message_body =~ s/>/>\n/g; print $message_body;
results in http://www.foo.com/bar.pl?aid=2744&bid=&cn=OMDdemo2&rid=0
While we're at it. the third substitute (the one with =3D) seems unnecessary, as the first substitute already transforms =3D into =.


Comment on Re: Parsing URL using regular expression
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://476525]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2014-09-17 22:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (100 votes), past polls