From: "mame (Yusuke Endoh)" Date: 2013-03-23T13:45:53+09:00 Subject: [ruby-core:53658] [ruby-trunk - Bug #8151][Assigned] Duplicate character class warning Issue #8151 has been updated by mame (Yusuke Endoh). Status changed from Open to Assigned Assignee set to akr (Akira Tanaka) Interestingly, this seems to be a bug of Regexp#to_s, not a regexp creation. re = /(?:[\u{33}])/ p re #=> /(?:[\u{33}])/ puts re.to_s #=> warning: character class has duplicated range: /[\u{33}]/ #=> (?-mix:[\u{33}]) As I recall, akr created round trip to_s. -- Yusuke Endoh ---------------------------------------- Bug #8151: Duplicate character class warning https://bugs.ruby-lang.org/issues/8151#change-37838 Author: tenderlovemaking (Aaron Patterson) Status: Assigned Priority: Normal Assignee: akr (Akira Tanaka) Category: Target version: ruby -v: ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.2.1] I get a duplicate character class warning, but I think it's a bug. Here is the example code: ``` def embed exp, depth return exp if depth == 0 embed(/#{exp}/, depth - 1) end 3.times { |i| puts "DEPTH #{i + 1}" embed(/[a-z\u{7b}-\u{7d}]/, i + 1) } ``` At depth = 1, there is no warning, but greater than 1, I get a duplicate character class warning. I don't think the character class overlaps, so there should never be a warning. -- http://bugs.ruby-lang.org/