How to Convert text list into 2d array

Giganews Newsgroups
Subject: How to Convert text list into 2d array
Posted by:  Andrew V. Romero (rrstudi…
Date: Fri, 25 Jul 2003

At work we have an excel file that contains the list of medications and
their corresponding strengths.  I would like to save the excel file as a
text list and paste this list into a javascript function and have JS put
this into an array.  Then JS would use this array to create a selection
list which displays only the names of the drugs.  When the user
selections one of the drugs, another selection list will be loaded with
the avaiable strengths of that drug.  The biggest problem I see if how
to get the list into a javascript array.  The list will look something
like (only a lot longer):

Acetaminophen tablets
* 80mg chewable
* 325mg caplet
* 500mg caplet
Acetaminophen supp.
"* 80mg, 120mg, 325mg, 650mg"
Acetaminophen liquid
* 650mg/20.3ml
Acetazolomide tablets
* 250mg scored
Acyclovir capsules
"* 200mg, 800mg"
Adeks tablets
Allbee + C capsules
Aspirin tablets
* 40.5mg chewable
* 81mg chewable
* 81mg enteric coated
* 325mg enteric coated
* 325mg buffered

I am not aware of a way in JS to simply paste this data as is into a
function and have the function read it and put it into an array.  Is
there a way I could put the whole list in "" and treat it as a string
and then do an split on the string at each line break?  Seeing as the
list is really long, I don't really want to have to type
array.push(value) on each and every line.

Even if this works, I will still likely need a way to turn the data into
a 2d array so that for example:
list[0][0] = acetaminophen tablets
list [0][1] = 80mg chewable, 325 caplet, 500mg caplet
list [1][0] = acetaminophen supp.

I imagine you could probably do this with some regular expression work
(which I am not very good at, but this would be a good chance to learn).
I just wanted to throw this idea out there and see if anyone has any
ideas on the best way to go about trying to do this.  If nothing else, I
could always just not make the web page very exciting and use excel to
save as web page and have people press control+f to find a drug, but
that is just so boring.

Thanks for your thoughts,    
    Andrew V. Romero

PS:  I know a server side langauge would be much better at doing this,
but I have no server side langauge avaiable on the company web server
(not my department).