From: "nobu (Nobuyoshi Nakada)" Date: 2013-03-03T17:11:35+09:00 Subject: [ruby-core:53115] [ruby-trunk - Bug #8001] 2.0 Regexp \Z matches where it shouldn't Issue #8001 has been updated by nobu (Nobuyoshi Nakada). Description updated ---------------------------------------- Bug #8001: 2.0 Regexp \Z matches where it shouldn't https://bugs.ruby-lang.org/issues/8001#change-37272 Author: josh.cheek (Josh Cheek) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin12.2.0] =begin for ruby in ~/.rbenv/versions/{1.9.3-p327,2.0.0-p0}/bin/ruby do "$ruby" -v "$ruby" -e 'p /x.*?\Z$/ =~ "x\ny"' done :In Ruby 1.9: (({nil})) :In Ruby 2.0: (({0})) If you remove the "y" from the string, or add more, then they do the same thing. The temporary solution I'm using to get around this is to replace `(({\Z}))` with `(({\n\z}))` =end -- http://bugs.ruby-lang.org/