On Tue, Mar 5, 2013 at 8:57 AM, Bartosz Dziewoński <[email protected]> wrote: > > On Tue, 05 Mar 2013 07:12:05 +0100, Josh Cheek <[email protected]> > 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/ -- [email protected] | https://groups.google.com/d/forum/ruby-talk-google?hl=en --- You received this message because you are subscribed to the Google Groups "ruby-talk-google" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
