in reply to Re: Re: Yet another regex bug.
in thread Yet another regex bug.
Well, your first line is the identity transformation, which isn't removing anything. ;-)
The parentheses surrounding the ?# are part of the syntax; that is, the comment marker in a regexp begins (?#, not ?#. (Check perlre: all the "funny" extended-pattern elements start with (?, one of the reasons being that it's a mnemonic to "question" what's coming next.1) Thus if you're removing the comment you should remove the parentheses as well.
1I don't buy the explanation, by the way, but it's there..