From: Thom Harp Date: 2001-12-12T12:44:11+09:00 Subject: [ruby-talk:28315] group substitution doesn't work in character classes? I'm trying to remove quoted substrings from a string. The substrings may be quoted with single or double quotes so I use the following regular expression which I thought would find the first quote character and remove everything up to the next occurance of that same character: /(['"])[^\1]*\1/ but the \1 doesn't seem to be interpreted within the negative character class. This line: puts %q|'a"b'c"d'e"|.sub(/(['"])[^\1]*\1/, "X") prints: Xe" and I would expect it to print: Xc"d'e" Is this a bug or is it expected that group substitution doesn't work in character classes? Thanks!