Project

General

Profile

Actions

Backport #8001

closed

2.0 Regexp \Z matches where it shouldn't

Added by josh.cheek (Josh Cheek) over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:53101]

Description

=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

Actions

Also available in: Atom PDF