java 这句正则哪错了,Pattern pattern = Pattern.compile("[\x00-\xff]");

报错:Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )
最新回答
桃靥

2024-10-16 12:23:40

反斜杠需要转义\在java字符串中要用\\表示
Pattern pattern = Pattern.compile("[\\x00-\\xff]");
灬夏伤

2024-10-16 11:27:19

你要匹配什么?
十六进制的字符串?\xYY这种格式?