N
Nilesh
Hi,
I am trying extract specific value out of URL query. Here is the
example.
my $text = "http://localhost/news.xmlapi/
StoryResponse.aspxServ=RT&Pkey=1245445784nSP376208-20090619210944-2-
FRT";
#my $text = "http://localhost/news.xmlapi/StoryResponse.aspx?
Pkey=124544 84nSP376208-20090619210944-2-FRT&Serv=RT";
if($text =~ m/&*Serv=(.*)[&$]/)
{
printf "$1\n";
} else {
printf "not matched";
}
it gives follwing error.
Unmatched [ in regex; marked by <-- HERE in m/&*Serv=(.*)[ <-- HERE
&5.008008/ at ./x.pl line 6
If I remove $ from character class then it works fine for first text.
But it does not work for commented definition of text which is also
possible case.
I don't know what is wrong with $(end of line) in character classs.
Thanks,
Nilesh
I am trying extract specific value out of URL query. Here is the
example.
my $text = "http://localhost/news.xmlapi/
StoryResponse.aspxServ=RT&Pkey=1245445784nSP376208-20090619210944-2-
FRT";
#my $text = "http://localhost/news.xmlapi/StoryResponse.aspx?
Pkey=124544 84nSP376208-20090619210944-2-FRT&Serv=RT";
if($text =~ m/&*Serv=(.*)[&$]/)
{
printf "$1\n";
} else {
printf "not matched";
}
it gives follwing error.
Unmatched [ in regex; marked by <-- HERE in m/&*Serv=(.*)[ <-- HERE
&5.008008/ at ./x.pl line 6
If I remove $ from character class then it works fine for first text.
But it does not work for commented definition of text which is also
possible case.
I don't know what is wrong with $(end of line) in character classs.
Thanks,
Nilesh