From: shaman Date: 2008-06-24T19:18:12+09:00 Subject: Re: Regular expressions and long text Guillermo.Acilu@koiaka.com pisze: > [Note: parts of this message were removed to make it a legal post.] > > Hello guys, > [cut] > I would like to do the following: > str = "Ruby is great. We all know that." > and get words[0]="Ruby is great" and ruby[1]="We all know that" > > Any ideas on how to do it with a regular expression instead of looping > through the string looking for the "."? > Hi, maybe you should to try this: words = str.split(/\.\s*/) it works for me: irb(main):008:0> str = "Ruby is great. We all know that." => "Ruby is great. We all know that." irb(main):009:0> words = str.split(/\.\s*/) => ["Ruby is great", "We all know that"] irb(main):010:0> words[0] => "Ruby is great" irb(main):011:0> words[1] => "We all know that" greetings