replaseAsciiCC.java
//Required to convert from hex to byte.
import javax.xml.bind.DatatypeConverter;
//Abbreviated as class definition or method definition
String hex = "0100313233343536373839302D5E5C"; //The first 4 bytes are control characters
byte[] hexFromByte = DatatypeConverter.parseHexBinary(hex);
String strFromByte = new String(hexFromByte);
String resultStr strFromByte.replaceAll("\\p{C}", ""));
//Control characters disappear"1234567890-^\"Should be output.
System.out.println(resultStr);
This is the reason why "\ p {C}" is fine. https://regular-expressions.mobi/unicode.html?wlr=1
Note that the line feed code is also removed. I don't know if it can be used in languages other than Java.