From: Robert Dober Date: 2009-04-08T22:29:51+09:00 Subject: Re: Concatenating Regex Smartly On Wed, Apr 8, 2009 at 12:00 PM, Robert Klemme wrote: > On 08.04.2009 11:47, Shak Shak wrote: >> >> Is there a way of quickly concatenating two full string patterns in a >> way that takes into account the boundaries? So for example: >> >> \A\d+\Z  and \A[a-z]+\Z Not that I am aware of, their semantics however is slightly different: irb(main):001:0> "abc\n" =~ /.\Z/ # \Z matches the \n => 2 irb(main):002:0> "abc\n" =~ /.\z/ # \z does not match the \n and neither does . => nil irb(main):003:0> "abc\n" =~ /.\z/m # Now, in multiline mode, the . matches the \n => 3 Now this is for 1.9 maybe this does not hold for 1.8. Cheers R. -- If you want to build a ship, don’t herd people together to collect wood and don’t assign them tasks and work, but rather teach them to long for the endless immensity of the sea. -- Antoine de Saint-Exupery