From: Peter Vandenabeele Date: 2010-12-05T05:16:14+09:00 Subject: Re: Split a string at a certain character On Sat, Dec 4, 2010 at 8:31 PM, Matt Slay wrote: > [part 1] followed by [part 2] > > which is to say: > > [part 1 = an integer or floating point number] followed by [part 2 = a > single or double set of letters (a-z or A-Z), which is then folled by an > integer] > > If there is a space between [part 1] and [part 2], it needs to be > ignored. Pick Axe page 70-75: ruby-1.9.2-head > s = '12.7 AB36' => "12.7 AB36" ruby-1.9.2-head > pattern = /\A([0-9.]+)\s*([a-zA-Z]{1,2}[0-9]+)\Z/ => /\A([0-9.]+)\s*([a-zA-Z]{1,2}[0-9]+)\Z/ ruby-1.9.2-head > s.match pattern => # ruby-1.9.2-head > $1 => "12.7" ruby-1.9.2-head > $2 => "AB36" HTH, Peter