Return specific characters from string

Hi

can any one suggest a code to return specific characters from string
like:
Thursday, Jan 17 to
23, 2013

I need to get number 23, or sometimes it can be 5 or 3 for example.
I need the number after text “to”

Thank you all in advance

Alexander G. wrote in post #1093339:

Hi

can any one suggest a code to return specific characters from string
like:
Thursday, Jan 17 to
23, 2013

I need to get number 23, or sometimes it can be 5 or 3 for example.
I need the number after text “to”

Thank you all in advance

Resolved:

exp = Thursday, Jan 17 to 23, 2013t

i = 0
exp.scan(/\d+/) do |x|
i = i + 1
if i == 2
@exp_day = x
end
puts @exp_day

=>23