title: Whats the difference between \z and \Z in a regular expression and when and how do I use it?
body: <p>From <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html" rel="noreferrer">http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html</a>:</p>
  
  <pre class="lang-none prettyprint-override"><code>\Z  The end of the input but for the final terminator, if any
  \z  The end of the input
  </code></pre>
  
  <p>But what does it mean in practice? Can you give me an example when I use either the \Z or \z.</p>
  
  <p>In my test I thought that <code>"StackOverflow\n".matches("StackOverflow\\z")</code> will return true and <code>"StackOverflow\n".matches("StackOverflow\\Z")</code> returns false. But actually both return false. Where is the mistake?</p>