From: dJD col Date: 2013-07-10T23:09:16+09:00 Subject: Re: search a string with ruby then read what comes after the string in the same line Joel Pearson wrote in post #1114921: > Something like this should do it: > >>> s="MAY seventh 2013\nJUNE seventh 2012\nJULY eighth 2014" > => "MAY seventh 2013\nJUNE seventh 2012\nJULY eighth 2014" >>> s.scan /June (.{7})/i > => [["seventh"]] > > Of course you might want to capture a whole word rather than exactly > seven characters: > /June (\w+)/i > or > /June (\w{7,})/i Thanks!!! works. -- Posted via http://www.ruby-forum.com/.