in reply to (jeffa) Re: A regex I cant get my head around
in thread A regex I cant get my head around

Thanks cLive and jeffa, but it has nothing to do with GET params. If
$text->as_string() = "startKEY=jdjhjfg8y4uh449845&finish"
what value ids assigned to $key?

Replies are listed 'Best First'.
(jeffa) 3Re: A regex I cant get my head around
by jeffa (Bishop) on Aug 03, 2002 at 21:13 UTC
    Why not find out for yourself? All you need to do is change your code to something like:
    my $as_string = 'startKEY=jdjhjfg8y4uh449845&finish'; $as_string =~ /KEY=([^&]+)\&/; print $1, "\n";
    Regardless of whether or not this has to do with GET params, you can still use URI to parse any key=value pairs that are delimited by ampersands:
    use strict; use URI; my $uri = URI->new(); $uri->query('startKEY=jdjhjfg8y4uh449845&finish'); my %pair = $uri->query_form(); print $pair{startKEY}, "\n";

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)