Project

General

Profile

Actions

Backport #8001

closed

2.0 Regexp \Z matches where it shouldn't

Added by josh.cheek (Josh Cheek) about 11 years ago. Updated about 11 years ago.


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

Like0
Like0Like0Like0Like0Like0Like0