in reply to Regex - remove characters (pattern not terminated)

"?" is taken to be the start of a ?...? operator, but there's no other "?" before the end of the file to end the operator, thus the error.

You seem to think ?( EXPR ){/w,6}; is valid Perl, but nothing about it is even close to Perl.