John said:
Ken said:
I have a simple regex [A-Z0-9]. This hits all uppercase characters and
numbers. I also want all control characters to be in there. anyone know
how?
[[:upper:][:digit:][:cntrl:]]
That's quite possibly the most readable form, but it is worth beng
aware that Perl supports a number of notations for character classes
and you can mix and match them at will.
For example if bervity is your bag:
[A-Z\d\pC]
Note also tha A-Z can only be considered equivalent to [:upper:] and
\pC equivalent to [:cntrl:] when working with ASCII strings. [:upper:]
also includes a lot of other characters outside the ASCII range. \pC
also includes "PrivateUse" and "Unassigned" which AFAIK are not in
[:cntrl:].
When working with ASCII you could choose to represent controls as any
of the following
[\x00-\x1f\x7f]
\p{Cc}
\pC
\p{Control}
\p{IsCntrl}
[[:cntrl:]]