java 官方文档:
https://docs.oracle.com/javase/7/docs/api/Backslashes within string literals in Java source code are interpreted as required by The Java™ Language Specification as either Unicode escapes (section 3.3) or other character escapes (section 3.10.6) It is therefore necessary to double backslashes in string literals that represent regular expressions to protect them from interpretation by the Java bytecode compiler. The string literal "\b", for example, matches a single backspace character when interpreted as a regular expression, while "\\b" matches a word boundary. The string literal "\(hello\)" is illegal and leads to a compile-time error; in order to match the string (hello) the string literal "\\(hello\\)" must be used.
试做翻译:
在.java 文件的代码中的字符串中的 Backslashes (也即\.)会按照 Java™ Language Specification ( java 语言的约定说明)的要求被解释为为 Unicode 或其他字符的转义(这句话我实在是翻译不通),因此在作为正则表达式的字符串中使用两个 Backslashes 来阻止 Backslashes 被 Java bytecode compiler (这是啥东西??)解释为其它东西是有必要的。举个例子,字符串『\b 』作为正则表达式时,匹配的时一个退格符,而『\\b 』匹配一个单词的分界( word boundary 是啥意思??)。字符串『\(hello\)』作为一个正则表达式是非法的并且会导致一个编译时错误,而匹配『(hello)』的正则表达式应该写作『\\(hello\\)』
我的问题倒是在最后一行解决了。。但是整个说明我其实没怎么看懂