What is the difference between the JDK6 java.util.regex.Pattern's "Boundary matchers" '\z' and '\Z'?
Background: I was trying to read a UTF-8 encoded file's contents into a String.
Home / DeveloperSection / Forums / Can anybody elaborate the difference between “Char” and “String” at Java
What is the difference between the JDK6 java.util.regex.Pattern's "Boundary matchers" '\z' and '\Z'?
Background: I was trying to read a UTF-8 encoded file's contents into a String.
Kate Smith
14-Oct-2013The difference is anchor \Z matches the empty string just before the newline, while \z matches empty string after the newline.
A very simple example to understand this is: