Whats the difference between \z and \Z in a regular expression and when and how do I use it?
- by Mister M. Bean
From http://java.sun.com/j2se/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
But what does it mean in practice? Can you give me an example when I use either the \Z or \z.
In my test I thought that "StackOverflow\n".matches("StackOverflow\\z") will return true and "StackOverflow\n".matches("StackOverflow\\Z") returns false. But actually both return false. Where is the mistake?