in reply to Matching enclosed expression
UPDATE:use URI; use URI::QueryParam; my $u = URI->new('http://www.com/index.pl?id=<idparm>&etc'); print $u->query_param('id'), "\n";
But BrowserUk has a point ... this is waaay overkill! At this point we might as well have just used:my $u = URI->new('http://www.com/index.pl?id=<idparm>&foo=bar&etc'); my @val = grep /<([^>]+)/, map $u->query_param($_), $u->query_param(); print $_,$/ for @val;
But what if it's the key that you want and not the value? What if both keys and values are surrounded with brackets and you only want the keys? Sometimes importing 400 lines of code is better than spending 400 minutes trying to get you own solution correct.@value = $URL =~ /(<[^>]+>)/;
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)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Matching enclosed expression (downvote opportunity!)
by BrowserUk (Patriarch) on Sep 15, 2003 at 02:48 UTC |