From: Daniel Waite Date: 2007-09-28T00:55:06+09:00 Subject: Break apart a string by kind of characters Hi all, I've an interesting problem. Imagine the following string: 'a1000aa' I want to break it apart like so: [ 'a', '1000', 'aa' ] I did a search on the forums and came up with this regex: 'a1000aa'.scan(/((.)\2*)/).map { |i| i[0] } Which is pretty close, but it groups on a change of character, so I would get: [ 'a', '1', '000', 'aa' ] I tried playing around with the regex (e.g. swapping the . for (\d|\w)) but to no avail. Any ideas? -- Posted via http://www.ruby-forum.com/.