in reply to Control characters

Control characters are three stroke tokens, \cA, \cB, etc. You cannot put parts of the tokens and put them into a character class. Use:
s/[\cA-\cZ]+//g;
or an equivalent tr construct.

Note also that your use of ^ means you are only going to replace matches at the beginning of the string - at most one character in your example. Which from your description doesn't seem to be want you want.

Replies are listed 'Best First'.
Re^2: Control characters
by AnomalousMonk (Archbishop) on Jun 05, 2009 at 17:11 UTC
    From the OP, it's not entirely clear (at least, to me) just what the OPer wants, but if all control characters are to be deleted, the substitution  s/[[:cntrl:]]+//g; might better serve: the POSIX character class syntax responds to one or both (I forget which) of Unicode and locale variations.

    And, of course, the other point to make to the OPer is that the character set  [\cA-\cZ] does not represent all control characters even in the ASCII character set.