in reply to Pattern matching: Why no \1 in [ ]?

As has been stated, a character class is determined at a regex's compile-time, because it's turned into a big bitwise array, more or less. Having a backref in there would make it dynamic, and dynamic char classes don't exist (yet?).

If $1 only has one character in it, then sure, you can do /(.)(?!\1)(?s:.)\1/ as was suggested. But if it's got more than one character, I think the "easiest" way is with the dynamic-regex assertion: /(.)(??{ "[^\Q$1\E]" })\1/.

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;