java.util.regex.Pattern中'\ Z'和'\ z'之间的区别

时间:2013-10-14 08:45:20

标签: java regex java-6

JDK6 java.util.regex.Pattern的“边界匹配器”'\ z'和'\ Z'之间有什么区别?

背景:我试图将UTF-8编码文件的内容读入String。遇到this solution。我发现java.util.scanner.useDelimeter使用了java.util.regex.Pattern。前面提到的解决方案提出'\ Z'。

1 个答案:

答案 0 :(得分:1)

根据http://docs.oracle.com/javase/1.5.0/docs/api/java/util/regex/Pattern.html,区别在于:

\Z  The end of the input but for the final terminator, if any
\z  The end of the input
相关问题