--e0cb4e6ff3655cf406049d69b8df
Content-Type: text/plain; charset=UTF-8

On Tue, Mar 1, 2011 at 10:55 AM, Peter Zotov <whitequark / whitequark.org>wrote:

>
> def questions(para)
>  para.scan(/([^!.]+?\?|.+?[!.])\w*/m).flatten.select { |m| m[-1] ??
> }.map &:strip
> end
>
> ruby-1.9.2-p136 :063 > str
>  "This is a sentence? Yes. And this too? Definitely!\n"
> ruby-1.9.2-p136 :064 > questions(str)
>  ["This is a sentence?", "And this too?"]
>
>
This could be a long rabbit hole.


questions("What does '?' mean?") #["What does '?", "' mean?"]

--e0cb4e6ff3655cf406049d69b8df--