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?"]