Issue #8133 has been updated by nagachika (Tomoyuki Chikanaga).


mame (Yusuke Endoh) wrote:
> Just for information: r39858 introduces the behavior change.
> Whether %r{n{3\}}} matches with:
> 
>           | "nnn}" | "n{3}}"
> ----------+--------+---------
> 1.9.3p392 |  YES   |  NO
> 2.0.0p0   |  NO    |  YES
> trunk     |  YES   |  NO
> 

On my environment the result was exactly opposite.

$ cat regexp_test.rb
re = %r{n{3\}}}
p re
p [re =~ "nnn}", re =~ "n{3}}"]

ruby 1.9.3dev (2011-09-24 revision 33322) [x86_64-darwin10.8.0]
/n{3\}}/
[nil, 0]

ruby 2.0.0p96 (2013-03-25 revision 39918) [x86_64-darwin10.8.0]
/n{3}}/
[0, nil]

ruby 2.1.0dev (2013-03-24 trunk 39908) [x86_64-darwin10.8.0]
/n{3\}}/
[nil, 0]


----------------------------------------
Bug #8133: Regexp macro %r{} is loosing backslash on "\}"
https://bugs.ruby-lang.org/issues/8133#change-37900

Author: jstribny (Josef Stribny)
Status: Closed
Priority: Normal
Assignee: 
Category: core
Target version: current: 2.1.0
ruby -v: 2.0.0


Hello,

Ruby 2.0.0 is loosing the backslash when used on "\}" string (exact match). 

How to reproduce in irb:

2.0.0-p0 :003 > %r{\}}
 => /}/ 
2.0.0-p0 :004 > %r{\{}
 => /\{/ 

Compared to:

1.9.3p392 :001 > %r{\{}
 => /\{/ 
1.9.3p392 :002 > %r{\}}
 => /\}/

This shouldn't probably happen.


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