From: Joel Pearson Date: 2013-07-10T06:36:06+09:00 Subject: Re: search a string with ruby then read what comes after the string in the same line 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 -- Posted via http://www.ruby-forum.com/.