From: Bill Kelly Date: 2001-11-22T10:20:04+09:00 Subject: [ruby-talk:26103] Re: Linux Magazine article From: "Jos Backus" > [...] > But what if you need to anchor the string? > Sadly, this doesn't work as I'd expect: > > mbox = 'apache-dev-list' > ext = mbox[/-(.*)/] > ext2 = ext[/-(.*)/] > puts "#{mbox},#{ext},#{ext2}" > > Fwiw, I was expecting to see > > apache-dev-list,dev-list,list Might need the "zero width pos/neg look_behind_ assertion" for that one. :-) Not supported in Ruby yet AFAIK... Alternatively, what about: x, ext, ext2 = mbox.scan(/[^-]+/) puts "#{mbox},#{ext}-#{ext2},#{ext2}" Regards, Bill