From: Intransition Date: 2010-12-07T14:20:24+09:00 Subject: Re: Split version requirements On Dec 7, 12:07 am, Ammar Ali wrote: > 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" ] Cool, I've never seen '?