Snoopy Dog wrote:
> Works fine, but I really don't care about the information past the date
> field.
> Additionally, I have another set of files that have a column after the
> vol, I am not sure how to handle it in the regular Expression.
>
> I just want to do:
>   (symbol, date, ignore_the_rest) = row.split(/,/) for just the first
> two columns.  I am off to read more on regular expressions.

Hi there,

The split method just returns an array of every item on either side of
the delimiter...

p row.split(/,/)
# => ["abc", " 20060901", " 1.5", " 2.1", " 1.4", " 1.9", " 123456\n"]

You can assign it to a variable:

a = row.split(/,/)
a[0]

You can index it anonymously:

row.split(/,/)[0]

Or unpack some (or all) members of it:

symbol, date = row.split(/,/)[0..1] # .. is a range operator

And so on.

I think you want something like the last example, but unless you need
the symbol too, you can just use: date = row.split(/,/)[1] An extra
column at the end of the rows won't effect anything.

Regards,
Jordan