Issue #5900 has been updated by Yui NARUSE.

Status changed from Open to Rejected

It is expected behavior.

See doc/re.rdoc:
* <tt>\Z</tt> - Matches end of string. If string ends with a newline,
  it matches just before newline
* <tt>\z</tt> - Matches end of string
----------------------------------------
Bug #5900: RegExp ??? Newline and \Z Anchor
https://bugs.ruby-lang.org/issues/5900

Author: Sebastian S
Status: Rejected
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]


/\Aaaa\Z/ =~ "aaa\n"
=> 0 #and should be nil

Same result in MRI 1.9.2.


-- 
http://bugs.ruby-lang.org/