The extra ^
symbols inside the bracket expression in your pattern are not, as I think you expect, negations; only the first ^
inside the brackets does that.
The main issue that is causing, apart from allowing that actual circumflex symbol to be matched when you didn't seem to want it, is that you end up with ^-^
being treated as a range.
To include a literal -
it has to be the first or last thing in the brackets; from the docs:
To specify a right bracket (]) in the bracket expression, place it first in the list (after the initial circumflex (^), if any).
To specify a hyphen in the bracket expression, place it first in the list (after the initial circumflex (^), if any), last in the list, or as an ending range point in a range expression.
So as you need to do both, make the hyphen last; you can change your pattern to:
'[^]A-Za-z0-9[.{}!@#$%*()_=+|\{}"'';:?/, -]'
You could also skip the tralsnate
step by including those special characters in the pattern too:
'[^]A-Za-z0-9[.{}!@#$%*()_=+|\{}"'';:?/, '||chr(10)||chr(11)||chr(13)||'-]'