howa wrote:
Hello,
I want to match a query string,
e.g.
http://abc.com/test.cgi?TEST=1&.type=xmlrpc&type=2
I want to extract the .type, currently i use
$ENV{"QUERY_STRING"} =~ /\.type=(.+?)(&|$)/; # This is okay
but back reference seem no good, i rewrite as
$ENV{"QUERY_STRING"} =~ /\.type=(.+?)[$&]/; # seem better, but not
working
any idea?
Unless you are committed to using a regex, a nicer idea may be to use
the excellent URI modules, as in the program below.
HTH,
Rob
use strict;
use warnings;
use URI;
use URI::QueryParam;
my $uri = URI->new('http://abc.com/test.cgi?TEST=1&.type=xmlrpc&type=2');
print $uri->query_param('.type');
**OUTPUT**
xmlrpc
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/