Iam really banging my head , Please help

Guys
Iam really mad over a problem , somebody please help

There is a text file from which images are loaded in flash . The pattern inside this file is :

&cat_0=LANDSCAPES& // this is the category

&cat_0_pic_0=x.jpg& // the images inside category
&cat_0_pic_1=y.jpg&

and so on and so forth !

Now can i wrtire an actionscript 2 code which :
Counts the total number of pic in the file ( the answer shud be 2 above !!)
Counts the image number in above file ( the answer shud be 0 for x.jpg and 1 for y.jpg )

Somebody please help , will be highly appreciated .
I dont mind providing free Orthopaedic opinion for the above help :slight_smile: on pm basis .
Thanks