From: nobu@... Date: 2014-12-29T09:59:04+00:00 Subject: [ruby-core:67205] [ruby-trunk - Bug #10670] [Closed] char-class matching same character with different encodings raises exception Issue #10670 has been updated by Nobuyoshi Nakada. Status changed from Open to Closed % Done changed from 0 to 100 Applied in changeset r49058. ---------- re.c: append excape sequence as-is * re.c (unescape_nonascii): append excape sequence as-is not unescaped character, to get rid of unexpected meta-character. [ruby-core:67193] [Bug #10670] ---------------------------------------- Bug #10670: char-class matching same character with different encodings raises exception https://bugs.ruby-lang.org/issues/10670#change-50683 * Author: Gregg Kellogg * Status: Closed * Priority: Normal * Assignee: * Category: * Target version: * ruby -v: ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14] * Backport: 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED ---------------------------------------- The following simple script illustrates the issue: ~~~ruby ESCAPE_PLAIN = /\A[\x5B]*\z/m.freeze 0x5B.chr(::Encoding::UTF_8) =~ ESCAPE_PLAIN 0x5B.chr =~ ESCAPE_PLAIN ~~~ `\x5B` is `']'`, run all lines above and get _in `=~': empty char-class: /\A[\x5B]*\z/m (RegexpError)_ Comment out either the first or second usage and the error goes away. -- https://bugs.ruby-lang.org/