I want to parse this expression

PFolder=Personal Folders&SFolder=Inbox&Message=3

and want to extract Personal Folders from PFolder,Inbox from SFolder and 3 from Message,so that i can further use this things "Personal Folders,Inbox and 3"in the program.

How can I do it?

Hi!

$s = "PFolder=PersonalFolder&SFolder=Inbox&Message=3";
@matches = ();

push @matches, $1 while $s =~ /=(.+?)(&|$)/g;

print join(", ", @matches);

Hope this helps.

Regards, mawe

that really looks like query string data, in which case the CGI module could be used to get you name value pairs into your script for further use.

Thanks mawe and Kevin!
U have helped me a lot!
Thanks and Regards,
Bhavna

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.