On Sep 28, 2007, at 6:09 AM, Lloyd Linklater wrote: > Gavin Kistner wrote: >> On Sep 27, 9:55 am, Daniel Waite <rabbitb... / gmail.com> wrote: >>> Hi all, I've an interesting problem. Imagine the following string: >>> >>> 'a1000aa' >>> >>> I want to break it apart like so: >>> >>> [ 'a', '1000', 'aa' ] >> >> irb(main):001:0> s = 'a1000aa' >> => "a1000aa" >> irb(main):002:0> s.split( /(\d+)/ ) >> => ["a", "1000", "aa"] > > Gavin, I'm not Gavin, but... > how in the WORLD does this bit of black magic work Captures in a Regexp passed to split() are returned as part of the result. > and how did you ever figure it out??? Interestingly, the documentation doesn't seem to mention it. I guess I knew it was there because Perl works the same way and I tried it sometime. James Edward Gray II