From: Robert Klemme Date: 2013-03-05T21:08:24+09:00 Subject: Re: YourLanguageSucks On Tue, Mar 5, 2013 at 8:57 AM, Bartosz Dziewoński wrote: > > On Tue, 05 Mar 2013 07:12:05 +0100, Josh Cheek > wrote: > >>> Regular expressions are always in multi-line mode >>> >> ? >> >> Was this ever true? It hasn't been since I've been using Ruby (about 5 >> years), unless I was just too noob when I started to realize it. > > > Yes, and still is. "multi-line mode" means that ^ matches the beginning of > a line, and $ the end of a line, instead of beginning/end of a string (Ruby > uses \A and \Z / \z for this). Note that Ruby's "multi line" mode is about matching of "." and not about anchoring of ^ and $. I'm not even sure there is a general definition of "multi line mode" for regular expressions across language. > "a\nb\nc"[­/^.*$/] => "a" > "a\nb\nc"[­/^.*$/m] => "a b c" Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/