[vox-tech] Finding the right tool for parsing

Ted Deppner ted at psyber.com
Sun Jan 20 08:41:34 PST 2008


On Sat, Jan 19, 2008 at 08:51:33PM -0600, Ken Bloom wrote:
> How about in ruby:
> Directions=Struct.new(:start,:distance,:time,:directions,:destination)
> result=TEXT.split(/\s+\.\s+Map data ??2008 Tele Atlas\s+/m).collect do|record|
>    lines=record.split("\n")
>    distance,time=lines[1].match(/^(.+)\((.+)\)/).captures
>    Directions.new(lines[0],distance,time,lines[2..-2],lines[-1])
> end

That's cool!

-- 
Ted Deppner
http://www.deppner.us/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.lugod.org/pipermail/vox-tech/attachments/20080120/0e2f53af/attachment.pgp


More information about the vox-tech mailing list