What is a regex for control characters?

I am trying to match a control character in the form \ ^ c, where c is any valid character for control characters. I have this regex, but it currently does not work:\\[^][@-z]

I think the problem is that the caret (^) character is part of the regular expression parsing mechanism.

+5
source share
2 answers

Match the ASCII text string of the form ^Xwith a template \^., nothing more. Match the ASCII text string of the form \^Xto the template \\\^.. You can limit this point to [?@_\[\]^\\], therefore \\\^[A-Z?@_\[\]^\\]. It is easier to read [?\x40-\x5F]for a copied character class, therefore, \\\^[?\x40-\x5F]for the BACKSLASH literal, followed by the literal CIRCUMFLEX, followed by something that turns into one of the valid control characters.

, , . , . , , , . `\\\\\\^[?\\x40-\\x5F]" , , , Java Groovy Scala - Perl Ruby - do. bbaacckksslllllaasshheesssssess.:)

, \pC GC = Other \p{Cc} GC = Control.

+7

All Articles