From: Ammar Ali Date: 2010-12-07T14:07:03+09:00 Subject: Re: Split version requirements On Tue, Dec 7, 2010 at 6:02 AM, Intransition wrote: > > > On Dec 6, 10:55 pm, Intransition wrote: >> Problem... >> >>   "rake >0.8 <1.0".split(/[^>=<]\s+/) >>   => ["rak", ">0.", "<1.0"] >> >> How to do this without loosing the trailing character? > > Note also spaces after operators should be ok too. I.e. We want: > >   "rake > 0.8 < 1.0".split(YOUR_REGEX) >   => ["rake", "> 0.8", "< 1.0"] In that case: >> "rake >0.8 <1.0".split(/(?=<])\s+/) [ "rake", ">0.8", "<1.0" ] >> "rake > 0.8 < 1.0".split(/(?=<])\s+/) [ "rake", "> 0.8", "< 1.0" ] Regards, Ammar