user2272260 user2272260 - 1 year ago 56
Ruby Question

Ruby : find/scan/search a string in a sentence in

I am trying to find a string in a sentence


want the string after
and before first
in ruby on rails

thanks in advance

Answer Source

You can do that with a simple regexp:

 string = '/a.117228558440230.24692.116944575135295/65456'

 regexp = /\D\.(\d*)\./
 #=> "117228558440230"