From: Eric Hodel Date: 2007-08-16T13:25:26+09:00 Subject: Re: excessively verbose request for help with regex and arrays On Aug 15, 2007, at 21:08, Simon Schuster wrote: > text = "(20:29:55) awhilewhileaway: I also need to assemble the > cover/back, and figure out the innards of the aimlog > formatting/keyword searches" > > what I want is essentially 3 fields, the text itself, the speaker > (stripped of the ":") and the date information, however as far as the > date information goes, it will be part of a short-stepped process, > which will only need to reference the previous one, so all data can > keep overwriting within two variables, as in: time_since_last - > time_current = time_it_took ... I think. I'm new to programming and > left math in highschool, so it's a weird (but very fun) place for my > mind to be. :) still working it out. Well, you haven't explained what you really want to do with your data yet, so that all sounds quite a bit complicated. Why not start out with just a simple split on space: time, speaker, content = text.split ' ', 3 Then you can parse the time: require 'time' time = Time.parse time Cut off the ':' on the speaker: speaker = speaker.sub(/:$/, '') and you'll be left with: p time, speaker, content Wed Aug 15 20:29:55 -0700 2007 "awhilewhileaway" "I also need to assemble the cover/back, and figure out the innards of the aimlog formatting/keyword searches" -- Poor workers blame their tools. Good workers build better tools. The best workers get their tools to do the work for them. -- Syndicate Wars