From: Ross Bamford Date: 2005-12-15T06:32:39+09:00 Subject: Re: regular expressions question On Wed, 14 Dec 2005 21:00:56 -0000, ako... wrote: > i need to capture all matches for a group. for example if > > 'ab c' =~ /^(.)*$/ > > i would like to get array [ 'a', 'b', ' ', 'c' ] > You could try: irb(main):001:0> "ab c".split('') # split on nothing => ["a", "b", " ", "c"] irb(main):002:0> "ab c".split(//) # same again => ["a", "b", " ", "c"] irb(main):003:0> "ab c".scan(/./) # scan on any single char => ["a", "b", " ", "c"] -- Ross Bamford - rosco@roscopeco.remove.co.uk "\e[1;31mL"